Question on message order
bblasko May 9, 2010 7:02 PMI would like to use the ESB to handle the following process
Messages are published to a JMS queue by an external system. There can be 3 different types of messages, depending on the header.
I would like to have a listener attached to the queue that will read the message and route to the appropriate service depending on data in the message.
How do I accomplish the routing without having the second message on the queue start processing before the first one is completed. It appears the CBR is async which means as soon as it routes the message, the service will return and pick up the next message.
Example of my config
JMS Provider has a single queue
Service A listens on the queue and has a single action for the CBR that routes to one of 3 based on header
Each of the sub services is marked as request/response and processes the message and returns a response.
Is there I was to do this so that at any one time only a single message from the queue is being processed by the ESB?
<providers>
<jms-jca-provider connection-factory="XAConnectionFactory"
name="inbound" transacted="true">
<jms-bus busid="JMSInGW">
<jms-message-filter acknowledge-mode="AUTO_ACKNOWLEDGE"
dest-name="queue/JMS_gw" dest-type="QUEUE" transacted="true"/>
</jms-bus>
<jms-bus busid="JMSIn">
<jms-message-filter acknowledge-mode="AUTO_ACKNOWLEDGE"
dest-name="queue/JMS" dest-type="QUEUE" persistent="true" transacted="true"/>
</jms-bus>
</providers>
<services>
<service category="ESB" description="Main Inbound" invmScope="NONE" name="MainListener">
<property name="maxThreads" value="1"/>
<listeners>
<jms-listener busidref="JMSInGW" is-gateway="true" maxThreads="1" name="JMSGWListener">
<property name="composer-class" value="com.mincom.mea.esb.JMSMessageComposer"/>
</jms-listener>
<jms-listener busidref="JMSIn" is-gateway="false" maxThreads="1" name="JMSListener">
<property name="composer-class" value="com.mincom.mea.esb.JMSMessageComposer"/>
</jms-listener>
</listeners>
<action class="org.jboss.soa.esb.actions.ContentBasedRouter"
name="ServiceRouter" process="process">
<property name="cbrAlias" value="Xpath"/>
<property name="ruleLanguage"/>
<property name="destinations">
<route-to expression="/Request[@serviceName='PurchaseReqCreate']"
service-category="Purchasing" service-name="CreatePurchaseReq"/>
<route-to expression="/Request[@serviceName='PurchaseReqModify']"
service-category="Purchasing" service-name="ModifyPurchaseReq"/>
<route-to expression="/Request[@serviceName='PurchaseReqDelete']"
service-category="Purchasing" service-name="DeletePurchaseReq"/>
</property>
</action>
</actions>
</service>
<service category="Purchasing"
description="Create new Purchase Requisition" invmScope="GLOBAL"
invmTransacted="true" name="CreatePurchaseReq">
<actions mep="RequestResponse">
<action class="org.jboss.soa.esb.actions.LogAction" name="LogMessage">
<property name="logLevel" value="info"/>
<property name="message" value="Processing CreatePurchaseRequisition message"/>
</action>
<service category="Purchasing"
description="Modify new Purchase Requisition" invmScope="GLOBAL"
invmTransacted="true" name="ModifyPurchaseReq">
<actions mep="RequestResponse">
<action class="org.jboss.soa.esb.actions.LogAction" name="LogMessage">
<property name="logLevel" value="info"/>
<property name="message" value="Processing ModifyPurchaseRequisition message"/>
</action>
<service category="Purchasing"
description="Dlete new Purchase Requisition" invmScope="GLOBAL"
invmTransacted="true" name="DeletePurchaseReq">
<property name="inVMLockStep" value="true"/>
<actions mep="RequestResponse">
<action class="org.jboss.soa.esb.actions.LogAction" name="LogMessage">
<property name="logLevel" value="info"/>
<property name="message" value="Processing DeletePurchaseRequisition message"/>
</action>
</actions>
</service>
</services>