Delayed Delivery
Delayed delivery allows you to introduce a time delay between the time when a message is published to the event broker and the time when that message is delivered to a consumer. The delivery delay time is a configurable endpoint attribute. This allows a single message to be delivered to different consumers with different time delays.
Delayed delivery can help you build stateless event-driven microservices. It can be used to trigger different microservices at different times. For example, in an e-commerce application, a single process order event might be sent to four different endpoints that are serviced by four different microservices:
- A fulfillment service which dispatches instructions to the warehouse to pick the items off the shelf and package the order. There is no time delay needed before processing this event, so the input queue to this service would not be configured with a delivery delay.
- A thank-you service which sends a thank you email to the customer. There is no time delay needed before processing this event, so the input queue to this service would not be configured with a delivery delay.
- A promotions service which, 30 minutes after the order is received, sends the customer an email with some suggested add-on purchases, based on the products the customer ordered. The input queue to this service would be configured with a 30 minute delivery delay.
- A rate-your-experience service which, three hours after the order is received, sends the customer an email with a link to a survey where they can rate their online shopping experience. The input queue to this service would be configured with a three hour delivery delay.
You can also use delayed delivery to implement a backout/retry design pattern. When a microservice is processing a message, it may encounter a transient error, and need to defer processing of the message to a later time. This can easily be done by having the microservice publish the message to a delayed delivery queue. Once the delivery delay time has passed, the delayed delivery queue will deliver the message back to the microservice for processing.
To learn how to configure delayed delivery using the Solace CLI, for queues see Configuring Delayed Delivery, and for topic endpoints see Configuring Delayed Delivery.
For more information about configuring delayed delivery for queues in PubSub+ Broker Manager, see Configuring Message Delivery options for PubSub+ Cloud or Configuring Message Delivery options for software event brokers and appliances.