I was wondering if the Rebus Service Bus can handle the following use cases:
- Queue messages for a future date
- if there is a message ProcessInvoice with a context like Customer Id: 1000, can we have exactly one handler executing the message. So in case the message is duplicated, it does not get processed again.
Thanks
Sure - Rebus can
bus.Defer
a message someTimeSpan
into the future - e.g. to postpone the delivery of a message to some specific date, something like this could do it:which requires that a timeout manager has been configured. You can configure a timeout manager by going
in the Rebus configuration spell.
If you want to guarantee that a given message is processed only once even though duplicates might be delivered, there's a couple of things to consider - it's hard to tell you the easiest way to handle it, because sometimes it can be easy to simply make the performed action idempotent, other times you'd need to track the ID of the processed message etc.