Apache camel 驼峰路由为单个jms主题消息运行多次

Apache camel 驼峰路由为单个jms主题消息运行多次,apache-camel,jms-topic,Apache Camel,Jms Topic,我在使用ApacheCamel处理JMS主题消息时遇到问题。 下面是我用来读取和处理消息的路由(Spring上下文片段): <camel:route id="refreshParameters" autoStartup="true" > <camel:from uri="activemq:topic:{{refreshParameters.inputTopic}}" /> <camel:log message="handling r

我在使用ApacheCamel处理JMS主题消息时遇到问题。 下面是我用来读取和处理消息的路由(Spring上下文片段):

 <camel:route id="refreshParameters" autoStartup="true" >
        <camel:from uri="activemq:topic:{{refreshParameters.inputTopic}}" />
        <camel:log message="handling refresh topic"></camel:log>
        <camel:log message="${body}" />
        <camel:unmarshal ref="RefreshParametersRequest" />
        <camel:bean ref="RefreshParametersHandler" method="refreshParameters" />
    </camel:route>
路由执行似乎是异步运行的,而不是处理重新尝试的结果。
此外,此路由是唯一的主题订户,但当处理停止时,消息仍在主题中。是否应该删除它,因为没有其他子用户可以发送此消息?

我发现将concurrentConsumers属性设置为1。让camel为一个主题创建一个消费者:尽管如此,我仍然不知道为什么其他消费者在其中一个已经收到消息时会开火。这与JMS服务器在主题中保留消息有关吗?这是可配置的吗?是的,研究JMS和主题的工作原理,主题上的每个消费者都会获得一份消息副本。所以这是意料之中的。如果您需要一个主题的并发使用者,并且您正在使用ActiveMQ,那么您可能需要查看。我发现将concurrentConsumers属性设置为1。让camel为一个主题创建一个消费者:尽管如此,我仍然不知道为什么其他消费者在其中一个已经收到消息时会开火。这与JMS服务器在主题中保留消息有关吗?这是可配置的吗?是的,研究JMS和主题的工作原理,主题上的每个消费者都会获得一份消息副本。所以这是意料之中的。如果您需要一个主题的并发使用者,并且您正在使用ActiveMQ,那么您可能需要研究。
thread #243 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #221 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #237 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #221 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #237 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #246 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #246 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #243 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #248 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #242 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #248 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #242 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #239 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #240 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #239 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #226 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #249 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #240 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #226 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #249 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}
thread #206 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #210 - JmsConsumer[refreshterm]:) handling refresh terminal topic
thread #210 - JmsConsumer[refreshterm]:) {"uId":"44298b83-9a88-4b80-9b16-e60d1cfeaf9a","tid":"12340003","iid":"TMS0","m":false}