Reputation: 23789
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
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