I have a situation where a console app (let's call it the Builder) and an NServiceBus endpoint (let's call it the Feeder) are both writing to the same data store. The Feeder processes EntityChanged messages as they come in, whereas the Builder goes to a database and gets the latest information for all Entities and writes the necessary information to the data store in one huge batch.
A problem that is immediately apparent from looking at how the Builder works is that it will clobber any changes to the data store that the Feeder makes whilst the Builder is running. So, what I need to do is stop the Feeder from processing NSB messages whilst the Builder is running and then for it to simply resume processing when the Builder finishes.
At the moment we devs do this because we run the Builder manually, ad hoc; we literally stop the Feeder service when we're about to run the Builder and then restart it afterwards. Now that we're going to run the Builder on a schedule we need to automate this process.
Stopping the Feeder service in an automated fashion is not ideal because our monitoring and alerting tools will go nuts, and anyway it's a Windows service that's set to restart automatically.
Is there a function in NServiceBus that can accomplish this for us? I originally thought of message Scheduling or Timeouts, but they are specifically configured by the sending endpoint. I need to timeout messages on the receiving endpoint.