Loading
Salesforce から送信されるメールは、承認済ドメインからのみとなります続きを読む

How to set AnypointMQ with circuit breaker and force that no more messages are processed once the circuit is open in Mule 4.x

公開日: Mar 2, 2024
タスク

GOAL

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.

 

 

その他のリソース
test-mqcircuitbreaker.jar
ナレッジ記事番号

001116605

 
読み込み中
Salesforce Help | Article