views:

91

answers:

1

I'm trying to create an Apache Camel route that sends a jms message to a topic and if it does not receive a reply within a certain amount of time it starts a route using Spring DSL.

The problem I am having is that it appears the foTopic call is asynchronous. I expect it to block and wait for a message or until the timeout is reached, but it sends the message to the topic and runs to the next processor. When the timeout occurs it calls the processor again. Are my expectations about the jms component wrong or do I have something configured incorrectly?

NOTE: I'm using camel 2.3.0 jars.

    <endpoint id="foTopic"
          uri="jms:topic:${jms.fotopic.topicName}?pubSubNoLocal=true&amp;requestTimeout=5000"/>

    <route id="foMasterRegistration" startupOrder="10">
        <!-- Fire this route once on startup. -->
        <from uri="timer:foStartTimer?period=0"/>
        <to uri="foPreProcessor"/>
        <doTry>
            <setExchangePattern pattern="InOut"/>
            <to uri="foTopic"/>
            <to uri="foProcessor"/>
            <doCatch>
                <exception>java.util.concurrent.TimeoutException</exception>
                <exception>org.apache.camel.ExchangeTimedOutException</exception>
                <to uri="foProcessor"/>
            </doCatch>
        </doTry>
    </route>
A: 

This was a misconfiguration on my part. It was indeed operating synchronously. I had originally placed the doCatch tag in the wrong spot which was causing strange message flow in the logs (what led me to post this question in the first place).

gwhitake