I'm trying to detect if the broker is available before I publish a message
onto a queue.

First attempt was to add a TransportListener as follows
[code]
<bean name="jms" class="org.apache.camel.component.jms.JmsComponent">
                <property name="connectionFactory">
                        <bean 
class="org.apache.activemq.ActiveMQConnectionFactory">
                                <property name="brokerURL"
value="failover(tcp://127.0.0.1:61616)?jms.prefetchPolicy.queuePrefetch=1"
/>
                                <property name="transportListener" 
ref="transportListener"></property>
                        </bean>
                </property>
        </bean>
  
    <bean id="transportListener"
class="com.opt2vote.ecount2g.broker.BrokerTransportListener" />
[/code]
The BrokerTransportListener just implements the TransportListener.
However I dont see any messages/logs appear when I start and stop the
ActiveMQ server.

Attempt two was to create a request/reply template with a
requesttimeout=5000 , were i would expect a reply before the 5secs timeout.
Otherwise I assume the activemq server has stopped.

String s =
producerTemplate.requestBody("activemq:queue:slow?requestTimeout=5000",
"Hello World", String.class);

However, the above method always generates an error regardless.

[code]
Caused by: org.apache.camel.ExchangeTimedOutException: The OUT message was
not received within: 5000 millis. Exchange[Message: Hello World]
        at
org.apache.camel.component.jms.JmsProducer.processInOut(JmsProducer.java:265)
[/code]

Any help would be much great.
    
    
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/How-do-I-Detect-ActiveMq-Broker-down-tp3297755p3297755.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to