문제

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>
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top