user3186786
user3186786

Reputation: 27

Ordering message receive in WCF

In WCF, what is the best/easiest way to enforce a particular order for receiving messages? For instance, let's assume that clients A, B, and C, simultaneously send messages X, Y, and Z to a service, respectively. At the service side, the service must handle the messages in a particular order such as Y, Z, and then X. What is the best way to enforce this ordering?

I have considered to use semaphores for this, but they seem too low level/error prone. So I'm wondering if there is an alternative to this (such as configuration files) that WCF might provide.

Upvotes: 0

Views: 92

Answers (1)

Pantelis Natsiavas
Pantelis Natsiavas

Reputation: 5369

I assume you are talking about a REST or SOAP web service built using WCF. There is no way to enforce an order in the request processing by the server. The WCF service will handle the http requests, as soon as they arrive. This is enforced by the HTTP protocol which has no way of controlling the way that clients send their HTTP requests... Therefore you could not apply semaphores or any such thing over HTTP.

You could though, arrange the received requests` order, after they arrive. You could use some king of internal id number, indicating the order of each message. You could of course arrange them by this ID.

Hope I helped!

Upvotes: 2

Related Questions