При использовании JMS-коннектора в потоке Mule запрос JMS будет асинхронным или мне нужно разместить JMS-коннектор внутри области Async Scope, и поэтому обработка потока должна обрабатываться независимо от запроса JMS?Использование JMS-коннектора на Mule
ответ
Это асинхронный. Нет необходимости в async
. Для получения дополнительной информации вы можете прочитать https://developer.mulesoft.com/docs/display/current/JMS+Transport+Reference
Вы должны держать в асинхронном блоке
Ref: http://blogs.mulesoft.com/dev/mule-dev/asynchronous-message-processing-with-mule/ https://docs.mulesoft.com/mule-user-guide/v/3.6/async-scope-reference
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP_Listener Configuration" />
<jms:activemq-connector name="Active_MQ" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ" numberOfConsumers="2" />
<flow name="samplepocFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<logger message="** Triggered the flow ** ${name} ${name}" level="INFO" doc:name="Logger"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[File file = new File("C://Users//schiraboina//Desktop//123.txt")
payload=file.getText() ]]></scripting:script>
</scripting:component>
<logger message="Final Data #[payload]" level="INFO" doc:name="Logger"/>
</flow>
<flow name="jms_message_sender">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP" allowedMethods="GET, POST" />
<set-payload value="JMS EXAMPLE" doc:name="Set Payload" />
<object-to-string-transformer doc:name="Object to String" />
<logger message="Sending message to queue" level="INFO" doc:name="Logger" />
<async doc:name="Async">
<jms:outbound-endpoint exchange-pattern="request-response" queue="MyQueue" connector-ref="Active_MQ" doc:name="JMS"/>
</async>
<logger message="After JMS " level="INFO" doc:name="Logger" />
</flow>
<flow name="jms_message_consumer">
<jms:inbound-endpoint exchange-pattern="request-response" queue="MyQueue" connector-ref="Active_MQ" doc:name="JMS" />
<logger message="Consuming Message from queue " level="INFO" doc:name="Logger" />
</flow>
На самом деле нет необходимости добавлять область Async. Одна из ссылок, которые вы только что добавили в свой ответ, говорит: «Некоторые транспорты и соединители, такие как JMS или VM, по умолчанию асинхронны». Так что @ eddú все еще правильно! – Gabriel
Правильно !!! – Gabriel