EIPinCPI – Durable Subscriber
This week, we’ll study a pattern known as the Durable Subscriber.
When do I use this pattern?
Durable Subscriber is used when messages have to be consumed even if the subscriber loses connection for a while. For example, an invoice sent from a System A to System B needs to be sent in any case otherwise the finances will not balance in System B.
For the demonstration, I’ll create the invoices using the Content Modifier. These Invoices need to be sent to Collection Center where money will be collected against these invoices. If invoices don’t reach Collection Center, the company won’t be able to collect the money. Same Invoices need to be sent to Financial Reporting system as well. Again, if the Financial Reporting system does not get a copy of the invoice, the reports will be wrong. Both of these systems need to be Durable Subscribers.
Durable Subscriber in CPI
I’ll use Enterprise Messaging of Cloud Platform Integration Suite to demonstrate the Durable Subscriber pattern.
Integration Flow – Publish Invoices
The Topic Name will be ‘Invoices’.
Integration Flow – Collection Center
This integration flow is step 13 from Jonathan‘s blog on the Publish-Subscribe pattern. The difference is that we are logging the payload instead of sending it to SFTP. Also, the Queue Name will be ‘CollectionCenter’.
Integration Flow – Financial Reporting
Similarly, this integration flow is step 13 from Jonathan‘s blog on the Publish-Subscribe pattern. The difference is that we are logging the payload instead of sending it to SFTP. Here, the Queue Name will be ‘FinancialReporting’.
To demonstrate the Durable Subscriber pattern, we’ll deploy Publish Invoices integration flow. We can see 1 message in each queue.
Now, we’ll deploy the Collection Center integration flow. The number of messages in CollectionCenter queue reduces to 0.
At this time, the financial reporting system is down. The Enterprise Messaging will keep the message in Financial Reporting queue until the message expires.
Once the financial reporting system comes back up, we can see that it consumes the message.
EIPinCPI Rating – 10/10
Enterprise Messaging supports durable subscribers out of the box. Therefore, this pattern gets 10/10 EIPinCPI rating.
Durable Subscriber is used when the subscriber must get the messages even if it loses connection for a while. In Cloud Platform Integration Suite, we can implement a Durable Subscriber using Enterprise Messaging.
- Durable Subscriber Pattern in Enterprise Integration Patterns
- Jonathan‘s blog on the Publish-Subscribe pattern
- CPI Components
Hope this helps,