Hi,

I have the following topic subscriber

public void configure() throws Exception {
ActiveMQConnectionFactory connectionFactory =
lookup(ActiveMQConnectionFactory.class);
JmsTransactionManager jmsTransactionManager =
lookup(JmsTransactionManager.class);

JmsEndpoint topic = (JmsEndpoint) endpoint("activemq:topic:MyTopic");
topic.setClientId("SomeClientID");
topic.setDurableSubscriptionName("SomeName");
topic.setRecoveryInterval(5000);// 5 seconds
topic.setMaxConcurrentConsumers(1);
topic.setConnectionFactory(connectionFactory);
topic.setTransactionManager(jmsTransactionManager);

JmsEndpoint toStore = (JmsEndpoint) endpoint("activemq:queue:ToStore");
toStore.setConnectionFactory(connectionFactory);
toStore.setTransactionManager(jmsTransactionManager);

from(topic).
 transacted("PROPAGATION_REQUIRED")
 .to(toStore);
}

And this is a part of the application context

<!-- setup JMS connection factory -->
<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>

<!-- setup spring jms TX manager -->
<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>

<beans:bean id="activemq"
class="org.apache.camel.component.activemq.ActiveMQComponent">
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="transacted" value="true" />
<property name="transactionManager" ref="jmsTransactionManager" />
</beans:bean>

This works fine, and topic messages are being forwarded to the queue. But
when I restart the ActiveMQ broker (which is on the same machine but running
as a different process), topic messages are no longer being forwarded to the
queue until I restart the camel process.

What is the recommended way to configure activemq endpoints in camel using
the java dsl?

Regards,
Leen

Reply via email to