0

我有两台服务器需要相同的提要信息(产品和测试)。以下确实有效:

<ns2:route id="JSON-INT" xmlns:ns2="http://camel.apache.org/schema/spring">
    <ns2:from uri="mq:MY.MQ.FEED"/>
    <ns2:marshal ref="feedToJsonTransformer" id="marshal2"/>
    <ns2:to uri="direct:internal" id="to5"/>
</ns2:route>

<ns2:route id="INT-PROD-AND-TEST-INTERNAL" xmlns:ns2="http://camel.apache.org/schema/spring">
    <ns2:from uri="direct:internal"/>
    <ns2:multicast stopOnException="false" id="multicast1">
        <ns2:to uri="direct:prod" id="to6"/>
        <ns2:to uri="direct:test" id="to7"/>
    </ns2:multicast>
</ns2:route>

<ns2:route id="INT-PROD" xmlns:ns2="http://camel.apache.org/schema/spring">
    <ns2:from uri="direct:prod"/>
    <ns2:to uri="jms:appProd" id="to8"/>
</ns2:route>

<ns2:route id="INT-TEST" xmlns:ns2="http://camel.apache.org/schema/spring">
    <ns2:from uri="direct:test"/>
    <ns2:to uri="jms:appTest" id="to9"/>
</ns2:route>

但是,当我在大约一个小时后关闭我的测试服务器(并不总是需要它并且要花钱)时,生产服务器停止接收消息。我假设队列正在填满并停止该过程?如果测试服务器关闭,有没有办法忽略它?

4

1 回答 1

0

我正在写以下内容,因为我假设您没有将交换模式更改为 InOut(因此您在即发即弃模式下使用 JMS)。

我建议以下几点:

  • 为确保您的消息不会永远停留在测试队列中,请尝试使用timeToLive选项。如果消息超时,JMS 提供程序将从队列中删除消息(默认为nullhttp ://camel.apache.org/jms.html ) - 您可以防止出现内存问题。
  • 如果您不期望任何响应(您当前的设置中没有响应),我会删除多播组件。如果您想确保在所有响应到达之前该过程不会继续(并且如果您需要以某种方式汇总响应),这将很有用。所以我会选择以下内容:
<ns2:route id="JSON-INT" xmlns:ns2="http://camel.apache.org/schema/spring">
    <ns2:from uri="mq:MY.MQ.FEED"/>
    <ns2:marshal ref="feedToJsonTransformer""/>
    <ns2:to uri="jms:appProd"/>
    <ns2:to uri="jms:appTest?timeToLive=10000"/>
</ns2:route>

就这么简单。不使用额外的路线,它更具可读性,并告诉你到底发生了什么。希望这会有所帮助,格格利

于 2013-06-11T08:27:27.693 回答