简体   繁体   中英

.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.

I did look at some examples of queueing using WCF but they seemed to have the queue on the server and not the client.

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 ',但它也会在服务器上排队。

You could use middleware for the queue (MSMQ etc).

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); and you have a dedicated worker thread that dequeues messages, does the WCF work, and processes the response.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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