I'm having a problem with handling JMS topic message using Apache Camel. Here's a route (Spring context fragment) I use to read and handle the message:
<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>
The route runs multiple times (about 60) for each message. From my undestanding it should be executed only once. Here's a log piece:
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}
Route executions seem to be run asynchronously and not being a result of handling reattempting. Moreover, this route is the only topic's subscriber, but when handling stops the message is still in the topic. Shouldn't it be deleted as there are no more subscibers this message can be delivered to?