Dmitri Nesteruk
Dmitri Nesteruk

Reputation: 23789

How do I correctly pool multiple message in NServiceBus?

I have an NServiceBus app which receives a particular message when a large database update is required. While this update is happening, I want to either somehow ignore all incoming messages of this type. What is the best way of doing it? Should I put a lock statement in there?

Upvotes: 0

Views: 170

Answers (1)

Jochen
Jochen

Reputation: 1488

In the config of NServiceBus (App.config) you can set the NumberOfWorkerThreads, if you set this to 1 only one message at a time will be processed.

Then if you keep the time you stopped processing this message in memory. You can drop all messages that have arrived between these two times.

But as Udi probably would say, don't try to solve it technically but find a solution from the business perspective.

Upvotes: 1

Related Questions