I have a consumer that implements the IConsumer<in TMessage>
interface in MassTransit. For each message that is consumed, a third party service is called.
However, the third party service has a daily scheduled downtime during the night. During those hours, we cannot communicate with that service. Therefore, it does not make sense for us to process messages from the MassTransit/RabbitMQ queue durings those hours. It would be better for us if we are able to pause our processing of messages during those hours.
Is there any way to achieve pausing of a queue for a scheduled window of time? Or, is there a retry mechanism that I can use, which also guarantees that the messages are processed in the received order? Is it possible to implement this with a custom middleware if there is not already built-in functionality to achieve this?
CodePudding user response:
There isn't anything built into MassTransit to only consume messages during a given timeframe. You might consider looking at options for starting/stopping the container/service for that consumer using some sort of scheduling solution.