简体   繁体   English

.net消息队列

[英].net message queueing

I have a winforms client application that sends messages to an asp.net web service, I need to be able to queue these messages on the client and then then send them in order, waiting for a response from the webservice before sending the next message. 我有一个winforms客户端应用程序,它将消息发送到asp.net Web服务,我需要能够在客户端上排队这些消息,然后按顺序发送它们,等待web服务的响应,然后再发送下一条消息。

I did look at some examples of queueing using WCF but they seemed to have the queue on the server and not the client. 我确实看过一些使用WCF排队的例子,但他们似乎在服务器而不是客户端上有队列。

Any advice abotu what technology to use and on how to implement a solution would be very much appreciated. 对于使用什么技术以及如何实施解决方案的任何建议都将非常感激。

Why wait for the response of the server before sending the next message? 为什么在发送下一条消息之前等待服务器的响应? there is no good reason to do that. 没有充分的理由这样做。 Just mark the messages with a sequence number and process them in order at the server. 只需使用序列号标记消息,然后在服务器上按顺序处理它们。

MSMQ has a queue both on the client and the server and moves the message when a connection is available. MSMQ在客户端和服务器上都有一个队列,并在连接可用时移动消息。

还有很好的' MSMQ ',但它也会在服务器上排队。

You could use middleware for the queue (MSMQ etc). 您可以使用中间件作为队列(MSMQ等)。

An alternative would be a thread-safe producer/consumer queue at the client. 另一种方法是客户端的线程安全的生产者/消费者队列。 Your "main" code just adds to the queue (ConcurrentQueue in 4.0 might work nicely here, although even in 4.0 I tend to use a utility queue I wrote a while ago instead); 你的“主要”代码只是添加到队列中(4.0中的ConcurrentQueue可能在这里工作得很好,尽管在4.0中我倾向于使用我前一段时间编写的实用程序队列); and you have a dedicated worker thread that dequeues messages, does the WCF work, and processes the response. 并且您有一个专用的工作线程,它使消息出列,WCF工作并处理响应。

如果您需要可靠的交付,为什么不将AMQP与RabbitMQ等消息代理一起使用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM