nservicebuseai

Nservicebus delayed message publishing


System A creates a new product and I'm using NServiceBus to send the new product to System B. Whenever there is an update to existing product in System A, it is also sent to System B immediately.

I have this new scenario: Products will have a life time determined by start date and end date. A new product could be created today in System A with 'start date' at some time in future, say after 5 days. System B is supposed to be fed with the active products only.

So when a product is created with future start date, I want System A to push the message to NServiceBus but let the integration layer to delay publish the message to System B.

How can this be achieved using NServiceBus. Or is there a different standard approach?

Thanks in anticipation.


Solution

  • The Bus.Defer API is designed explicitly for these scenarios.