You have a Mule Application that uses Anypoint MQ with the Circuit Breaker functionality and you want to ensure that once the error threshold is reached and the circuit is open no more messages are processed.
Typically the Circuit Breaker functionality is used to ensure that once an error threshold is reached no more messages are consumed from the broker, however, it does not enforce that messages already consumed (Prefetched) or being processed in parallel after the last consecutive failure do not get processed. For more information on the Circuit Breaker, please refer to <https://docs.mulesoft.com/anypoint-mq-connector/3.x/anypoint-mq-listener#circuit-breaker-capability>.
To achieve this use case you need to ensure that messages get processed one by one and also to tweak the prefetch. Setting the max concurrency of the flow to 1 and the prefetch to 1 should suffice for this behavior.
The connector configuration will look like:
<anypoint-mq:config name="Anypoint_MQ_Config" doc:name="Anypoint MQ Config">
<anypoint-mq:connection clientId="${ID}" clientSecret="${Secret}" />
</anypoint-mq:config>
The Flow with max concurrency = 1:
<flow name="test-circuitBreakerFlow" maxConcurrency="1">
The AnypointMQ message subscriber:
anypoint-mq:subscriber doc:name="Subscriber" config-ref="Anypoint_MQ_Config" destination="${yourQueue}" acknowledgementMode="MANUAL">
<anypoint-mq:subscriber-type >
<anypoint-mq:prefetch maxLocalMessages="1" />
</anypoint-mq:subscriber-type>
<anypoint-mq:circuit-breaker tripTimeout="${time}" onErrorTypes="${type}" errorsThreshold="${threshold}" tripTimeoutUnit="MINUTES"/>
</anypoint-mq:subscriber>
Please also refer to the Mule Application example attached showing how the behavior described in the article works.
Disclaimer: This solution provides a suggestion that should be considered in conjunction with your specific use-case and requirements and does not represent a complete solution for all circumstances.
001116605

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.