Roelant M
Roelant M

Reputation: 1706

NServicebus approach multiple queues

We are processing a bunch of messages on a single queue, all looks good. Several handlers that will take care of that. But now we are coming to the case that we need to process messages coming from one user synchronously. at the start of a message i do not know what and if there will be new messages coming from that user.

So the use-case; - user one completes step 1 => 3 tasks needs to be executed, synchronously. - user one completes step 2 => new 5 tasks needs to be executed, synchronously (making sure that the previous tasks are also completed, because data synchronisations issues). - user two completes step 1 => 3 tasks needs to be executed,synchronously. - same for step 2.

Across users it can be done a-synchronously, but within a single user, it needs to be done synchronously. Is this possible with NServiceBus? If so, how, and what would be the best approach?

Thanks

Upvotes: 0

Views: 383

Answers (1)

Sean Feldman
Sean Feldman

Reputation: 25994

NServiceBus is designed for asynchronous messaging. If you need to ensure a certain order of operations per user, it would not be synchronous execution. Instead, you could look into the Saga feature of NServiceBus that does work coordination. Saga would coordinate the work done by other handlers and coordinate the steps.

There's also a tutorial that could be a good point to start from.

Upvotes: 3

Related Questions