JBoss ESB 消息被错误的服务接收

发布于 2024-10-07 02:37:45 字数 4063 浏览 0 评论 0原文

我在 jboss-esb.xml 中配置了多个服务,当我向其中一项服务发送消息时,我的消息将由已配置的服务之一接收(即使该消息不适用于该服务)!

如果我再次发送相同的消息,另一个服务将处理该消息(以循环方式),它不是随机的,就像每个服务轮流拦截该消息。

例如,如果我配置了 3 个服务。第一次发送消息,服务 1 会收到,第二次发送消息,服务 2 会收到,第三次发送消息,服务 3 会收到。我第四次发送它,服务 1 将收到它并重复循环。

我怀疑我配置 jboss-esb.xml 的方式有问题,但我一无所知。

这是我调用服务的方式,

ServiceInvoker invoker = new ServiceInvoker("NTIAdaptor", "SearchAccountByParentInternalId");
Message replyMessage = invoker.deliverSync(requestMessage, TIMEOUT);

这是 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="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>

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="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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放手` 2024-10-14 02:37:45

您遇到该问题是因为您在各个服务中使用相同的 jms-bus。尝试为每个服务 jms 侦听器使用不同的 jms-bus。

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.

背叛残局 2024-10-14 02:37:45

如果不是曼努埃尔所说的那样,我们也遇到了与您类似的问题,消息发送到了错误的服务。
在我们的例子中,当我们将监听器从一种服务更改为另一种服务时,juddi 寄存器没有改变。所以我们最终有 2 个服务监听同一个队列。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文