How to use JMS Selector
03-04-2017
Abstract
• You can set a JMS selector as a filter on an
inbound endpoint. The JMS selector simply
sets the filter expression on the JMS
consumer.
• .mflow
• <?xml version="1.0" encoding="UTF-8"?>
• <mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
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/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
• http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
• <jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
• <flow name="JMSFlow" >
• <poll doc:name="Poll">
• <fixed-frequency-scheduler frequency="10" timeUnit="SECONDS"/>
• <set-payload value="Flow1" doc:name="Set Payload"/>
• </poll>
• <jms:outbound-endpoint queue="myqueue" connector-ref="Active_MQ" doc:name="JMS">
• <set-property propertyName="MULE_CORRELATION_ID" value="1234"></set-property>
• </jms:outbound-endpoint>
• </flow>
• <flow name="JMSFlow1">
• <jms:inbound-endpoint queue="myqueue" connector-ref="Active_MQ" doc:name="JMS">
• <jms:selector expression="JMSCorrelationID='1234'"/>
• </jms:inbound-endpoint>
• <logger message="#[payload]----------" level="INFO" doc:name="Logger"/>
• </flow>
• </mule>
• Output:
• Reference:
• https://docs.mulesoft.com/mule-user-
guide/v/3.5/jms-transport-reference

Jms selector

  • 1.
    How to useJMS Selector 03-04-2017
  • 2.
    Abstract • You canset a JMS selector as a filter on an inbound endpoint. The JMS selector simply sets the filter expression on the JMS consumer.
  • 4.
    • .mflow • <?xmlversion="1.0" encoding="UTF-8"?> • <mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" 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/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd • http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd"> • <jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/> • <flow name="JMSFlow" > • <poll doc:name="Poll"> • <fixed-frequency-scheduler frequency="10" timeUnit="SECONDS"/> • <set-payload value="Flow1" doc:name="Set Payload"/> • </poll> • <jms:outbound-endpoint queue="myqueue" connector-ref="Active_MQ" doc:name="JMS"> • <set-property propertyName="MULE_CORRELATION_ID" value="1234"></set-property> • </jms:outbound-endpoint> • </flow> • <flow name="JMSFlow1"> • <jms:inbound-endpoint queue="myqueue" connector-ref="Active_MQ" doc:name="JMS"> • <jms:selector expression="JMSCorrelationID='1234'"/> • </jms:inbound-endpoint> • <logger message="#[payload]----------" level="INFO" doc:name="Logger"/> • </flow> • </mule>
  • 5.
  • 6.