简体   繁体   中英

Is it possible to schedule when during the days not to consume message from MassTransit/RabbitMQ?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM