How to Use the Circuit Breaker Functionality in Anypoint MQ

Circuit breaker design pattern is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring during maintenance, temporary external system failure, or unexpected system difficulties. Here's how it works and how you can use this functionality with Anypoint MQ.

How Does Circuit Breaker Design Pattern Work?

Circuit breaker handles faults that might take a variable amount of time to recover from when connecting to a remote service or resource. This can improve the stability and resiliency of an application.

Functioning of Anypoint MQ DLQ in Mule 3

Anypoint MQ is a cloud messaging service that allows customers to perform advanced asynchronous messaging between their applications.

The dead-letter queue is the queue that messages get sent if they can't be routed to their correct destination.

Step-by-Step Guide to Use Anypoint MQ: Part 4

This is the last part of the Anypoint MQ Series. You can read previous parts here: Part 1; Part 2; Part 3. In this post, we will learn about message exchanges and how we can use the  to send messages to multiple queues. We will also see how we can bind queues and publish messages to a message exchange. We may need to send the same message to more than one queue (to broadcast the message); in that scenario, message exchanges can be used.

What Is a Message Exchange?

A message exchanges bind one or more queues so that the message sent to exchange appears in all the queues bound to it simultaneously. In other words, with message exchanges, we can send the same message to all the queues which are bound to it.

Step-by-Step Guide to Use Anypoint MQ: Part 2

This blog is the second part of the Step-by-Step Guide to Use Anypoint MQ series. You can find Part 1 here. In this blog, we will learn about dead letter queue (DLQ) and how to use it in the Mule API.

Dead Letter Queue (DLQ)

A dead letter queue is used to keep/store the undelivered messages that are not routed to the destination. DLQ, sometimes referred to as an undelivered message queue, is a holding queue for messages that cannot be delivered to their destination queues.

Using FIFO Queues to Order Messages in Mule 4

Objective

Very often we come across requirements to maintain the order of messages that flow through the integration layer. For example, if Source System A updates a record, it needs to be updated accordingly in Target System B, but when there are multiple consecutive updates in System A, those need to be updated in the Target System B in the correct order. In a distributed multi-threaded environment, there is always a chance of a race condition where an older record may overwrite a newer record.

Scenario

If the status of an entity in Source System A, say #1234 is updated as “In-Progress” and subsequently updated again to “Complete”, the Source System A invokes an API implemented in Mule every time there is a status update to sync the record with Target System B. Most of the time, we would prefer implementing an asynchronous flow with queues in between to sync the records between the two systems. If the API invokes a publisher flow which publishes the messages into a Queue (say in Anypoint MQ) and there is a subscriber flow picks up the messages and updates the Target System B, then we can not guarantee the order of messages. Considering this scenario, there is always a chance that the status of “Complete” gets overwritten by “In-Progress” in the Target System B. The below diagram explains the scenario.