0

I have two servers that require the same feed information (prod and test). The following does work:

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

However when I shut down my test server (it isn't always needed and costs money) after about an hour the production server stops receiving messages. I am assuming the queue is filling right back and stops the process? Is there a way to ignore the test server if it is down?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Kevin
  • 312
  • 1
  • 4
  • 9

1 Answers1

0

I'm writing the following as I'm assuming you didn't change the Exchange Pattern to InOut (so you're using your JMS in fire-and-forget mode).

I'd advice the following:

  • to ensure your messages are not stucked in the test queue forever, try using the timeToLive option. The JMS provider will remove the message from the queue if it times out (default is null: http://camel.apache.org/jms.html) - you can prevent memory issues with it.
  • If you don't expect any response (which you don't at you're current setup), I'd remove the multicast component. It'd be useful if you wanted to ensure that the process won't continue until all the responses arrives (and if you needed the responses aggregated somehow). So I'd go with the following:
<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>

Simple as this. Without using additional routes it's more readable and tells you what exactly is happening. Hope this helps, Gergely

Gergely Kovács
  • 599
  • 1
  • 5
  • 15
  • Hi, thank you for your reply. I tested your implementation this morning, after about an hour it still stops sending messages to prod. Any ideas? – Kevin Jun 12 '13 at 10:53
  • Hi, check the following: - ensure the route gets the messages (add logging to the beginning and to the end) - ensure that no exception is thrown - ensure the JMS queues are not removed after an amount of time BTW I think it isn't a Camel issue. – Gergely Kovács Jun 12 '13 at 13:25