camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Camel-jms with ActiveMQ: loosing messages by using non persistent messaging
Date Wed, 20 Oct 2010 11:43:30 GMT
A few weeks ago, I started a thread on the Camel dev channel [1] about
loosing messages if I use non persistent messaging with ActiveMQ. The broker
shoot down, if the single, non persitent connection was closed and start the
broker again, if I open a new connection to it (I have to configure the
connection factory in another configuration file than the activeMQ
component, because this connection factory will be taken from the OSGI
registry in our deployment, but it not exist in our unit test):

{code:title=bundle-context.xml}
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="connectionFactory" ref="connectionFactory" />
</bean>
{code}

{code:title=bundle-context-test.xml}
<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
  <property name="brokerURL"
value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false" />
</bean>
{code}

{code}
2010-09-13 19:49:19,937 [main           ] INFO  BrokerService - ActiveMQ
5.3.1-fuse-02-00 JMS Message Broker (localhost) is starting
2010-09-13 19:49:20,234 [main           ] INFO  BrokerService - ActiveMQ
Message Broker (localhost,
ID:defm-ar063470-1372-1284400159969-0:0) is shutting down
...
2010-09-13 19:49:20,250 [main           ] INFO  BrokerService - ActiveMQ
5.3.1-fuse-02-00 JMS Message Broker (localhost) is starting
2010-09-13 19:49:20,281 [main           ] INFO  BrokerService - ActiveMQ
Message Broker (localhost,
ID:defm-ar063470-1372-1284400159969-0:1) is shutting down
{code}

I was wondering, because if I use the following configuration (only one
spring configuration file), it works:

{code:title=bundle-context.xml}
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="brokerURL"
value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false" />
</bean>
{code}

So, I went a bit deeper in this and I realized, that in the first one use
the ActiveMQConnectionFactory and the second one the
PooledConnectionFactory. With this information, I changed my configuration
to also use the PooledConnectionFactory:

{code:title=bundle-context.xml}
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="connectionFactory" ref="connectionFactory" />
</bean>
{code}

{code:title=bundle-context-test.xml}
<bean id="connectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
  <constructor-arg
value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
</bean>
{code}

Yeah, and it works also... :-)
This means we can use non persistent messaging for our tests (with
exceptions for suspend-resume and durable topic tests).

I think this is also useful for the Camel tests, is it? I can do the
work....

[1]
http://camel.465427.n5.nabble.com/Camel-jms-and-ConsumerTemplate-cause-org-apache-activemq-transport-TransportDisposedIOException-Peerd-tp2838098p2838098.html

Regards,
Christian

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message