Anypoint MQ Connector の Studio の [Global Element Properties (グローバル要素のプロパティ)] メニューで [Acknowledgment Mode (肯定応答モード)] を [NONE (なし)] に設定できます。
[NONE (なし)] フローでは、何が発生した場合でも、Anypoint MQ Connector が常に ACK を送信します。
|
|
[NONE (なし)] は Anypoint MQ Connector - Mule 4 では [IMMEDIATE (即時)] と呼ばれますが、機能は同じです。
|
次の例は、Java クラス RandomError を使用して考えられる例外を作成することでこのリスクを強調しますが、それらの例外は無視して ACK を送信します。
<component class="ackmodes.RandomError" doc:name="Java"/>
<logger level="ERROR" doc:name="Logger"
message="Always ACKs as soon as a message is received"/>
このモードを使用するとアプリケーションはシンプルになりますが、リスクが高まります。このモードは、ニュースの詳細が明らかになっていくニュースフィードのように、メッセージが常に相互に更新される場合に最適です。例外が発生した場合、次のメッセージが適切なコンテンツを取得する機会があります。
[NONE (なし)] の XML コード
[NONE (なし)] 肯定応答モードの XML コードは次のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:anypoint-mq="http://www.mulesoft.org/schema/mule/anypoint-mq"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/tracking
http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-current.xsd
http://www.mulesoft.org/schema/mule/anypoint-mq
http://www.mulesoft.org/schema/mule/anypoint-mq/current/mule-anypoint-mq.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration_none"
host="0.0.0.0" port="8083" doc:name="HTTP Listener Configuration"/>
<flow name="noneHttp">
<http:listener config-ref="HTTP_Listener_Configuration_none"
path="/" doc:name="HTTP"/>
<anypoint-mq:publish config-ref="Anypoint_MQ_Configuration"
destination="none" doc:name="Anypoint MQ"/>
</flow>
<flow name="noneMq">
<anypoint-mq:subscriber config-ref="Anypoint_MQ_Configuration"
destination="none" doc:name="Anypoint MQ"
pollingTime="10000"
AcknowledgmentMode="NONE"/>
<component class="ackmodes.RandomError" doc:name="Java"/>
<logger level="ERROR" doc:name="Logger"
message="Always ACKs as soon as a message is received"/>
</flow>
</mule>