JBoss ESB Message is received by the wrong Service
I have several services configured in jboss-esb.xml, when I send message to one of the service, my message will be received by one of the configured services (even though the message is not meant for that service)!
If I send the same message again, another service will process that message (in round-robin maner), it is not random, it is like each service takes turn to intercept the message.
Example, if I have 3 services configured. First time I send a message, Service 1 will receive it, second time I send a message, Service 2 will receive it, third time I send the message, Service 3 will receive it. Fourth time I send it, Service 1 will receive it and the cycle repeat..
I suspect there is something wrong with the way I configured my jboss-esb.xml, but I am clueless.
Here is how I invoke the service,
ServiceInvoker invoker = new ServiceInvoker("NTIAdaptor", "SearchAccountByParentInternalId");
Message replyMessage = invoker.deliverSync(requestMessage, TIMEOUT);
And here is the jboss-esb.xml,
<?xml version="1.0"?>
<jbossesb parameterReloadSecs="5"
xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
<providers>
<jms-provider connection-factory="ConnectionFactory" name="JMS Provider">
<jms-bus busid="NTI">
<jms-message-filter dest-name="queue/NTIAdaptor" dest-type="QUEUE"/>
</jms-bus>
</jms-provider>
</providers>
<services>
<service category="NTIAdaptor"
description="SearchAccountByExternalId" name="SearchAccountByExternalId">
<listeners>
<jms-listener busidref="NTI" name="JMS"/>
</listeners>
<actions mep="RequestResponse" webservice="true">
<action class="com.krona.esb.action.AuthenticateAction" name="authenticate"/>
<action class="com.krona.esb.action.LogAction" name="logStart"/>
<action
class="com.krona.esb.account.action.SearchAccountByExternalIdAction"
name="process" process="process"/>
<action class="com.krona.esb.action.LogAction" name="logEnd"/>
</actions>
</service>
<service category="NTIAdaptor"
description="SearchAccountByInternalId" name="SearchAccountByInternalId">
<listeners>
<jms-listener busidref="NTI" name="JMS"/>
</listeners>
<actions mep="RequestResponse" webservice="true">
<action class="com.krona.esb.action.AuthenticateAction" name="authenticate"/>
<action class="com.krona.esb.action.LogAction" name="logStart"/>
<action
class="com.krona.esb.account.action.SearchAccountByInternalIdAction"
name="process" process="process"/>
<action class="com.krona.esb.action.LogAction" name="logEnd"/>
</actions>
</service>
<service category="NTIAdaptor"
description="SearchAccountByParentInternalId" name="SearchAccountByParentInternalId">
<listeners>
<jms-listener busidref="NTI" name="JMS"/>
</listeners>
<actions mep="RequestResponse" webservice="true">
<action class="com.krona.esb.action.AuthenticateAction" name="authenticate"/>
<action class="com.krona.esb.action.LogAction" name="logStart"/>
<action
class="com.krona.esb.account.action.SearchAccountByParentInternalIdAction"
name=开发者_如何学JAVA"process" process="process"/>
<action class="com.krona.esb.action.LogAction" name="logEnd"/>
</actions>
</service>
<service category="NTIAdaptor"
description="SearchAccountByServiceExternalId" name="SearchAccountByServiceExternalId">
<listeners>
<jms-listener busidref="NTI" name="JMS"/>
</listeners>
<actions mep="RequestResponse" webservice="true">
<action class="com.krona.esb.action.AuthenticateAction" name="authenticate"/>
<action class="com.krona.esb.action.LogAction" name="logStart"/>
<action
class="com.krona.esb.account.action.SearchAccountByServiceExternalIdAction"
name="process" process="process"/>
<action class="com.krona.esb.action.LogAction" name="logEnd"/>
</actions>
</service>
</services>
</jbossesb>
You are experiencing that problem because you're using the same jms-bus across services. Try using a different jms-bus for each service jms listener.
If is not what Manuel says, we had a similar problem to yours, messages were getting to the wrong services. In our case it was that the juddi register wasn't altered when we changed a listener from one services to another. So we ended with 2 services listening to the same queue.
精彩评论