You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Alistair Young <Al...@uhi.ac.uk> on 2011/06/23 13:00:24 UTC

Disappearing topics in routes

If I declare a route:

<from uri="activemq:topic:src"/>
<to uri="activemq:topic:dest"/> 

when I restart tomcat, the activemq:topic:src is still there as it has persistent messages but the activemq:topic:dest topic disappears along with all messages waiting for durable subscribers in it.

Camel takes all the messages from dest and puts them in src, and they are all then lost as src is destroyed on restart. Somehow the messages are not marked as persistent in the dest topic.

I've tried transacted routing but it still doesn't work. I'm using ruby clients over STOMP to send and receive persistent messages via the route:

  <broker brokerName="matrixBroker" id="matrixBrokerID" useJmx="true" persistent="true" xmlns="http://activemq.apache.org/schema/core">
    <transportConnectors>
      <transportConnector uri="tcp://localhost:61616" />
      <transportConnector name="stomp" uri="stomp://localhost:61613"/>
    </transportConnectors>
  </broker>

	<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="matrixBrokerID">
		<property name="brokerURL" value="vm://matrixBroker?create=false"/>
	</bean>

	<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
		<property name="connectionFactory" ref="jmsConnectionFactory"/>
	</bean>

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


can anyone help please?

thanks,

Alistair

-- 
mov eax,1
mov ebx,0
int 80h





Re: Disappearing topics in routes

Posted by Alistair Young <al...@uhi.ac.uk>.
so I sorted that error but persistent messages are destroyed by camel routes. As soon as camel moves a persistent message from the src topic to the dest topic, it's no longer persistent and is discarded on restart. Even if the route is transacted. Of course, I'm prolly not understanding what transacted means in this case.

I'm just trying to send a persistent message to a topic and have it routed as a persistent message to another topic. Is this possible without transaction specific code in the clients?

Alistair

-- 
mov eax,1
mov ebx,0
int 80h




On 23 Jun 2011, at 12:41, Alistair Young wrote:

> forgot to add transacted to the route:
> 
> <route>
>  <from uri="activemq:topic:src"/>
>  <transacted />
>  <to uri="activemq:topic:dest"/> 
> </route>
> 
> but I just get the error:
> 
> Invalid content was found starting with element 'transacted'. One of .. expected
> 
> Alistair
> 
> -- 
> mov eax,1
> mov ebx,0
> int 80h
> 
> 
> 
> 
> On 23 Jun 2011, at 12:00, Alistair Young wrote:
> 
>> If I declare a route:
>> 
>> <from uri="activemq:topic:src"/>
>> <to uri="activemq:topic:dest"/> 
>> 
>> when I restart tomcat, the activemq:topic:src is still there as it has persistent messages but the activemq:topic:dest topic disappears along with all messages waiting for durable subscribers in it.
>> 
>> Camel takes all the messages from dest and puts them in src, and they are all then lost as src is destroyed on restart. Somehow the messages are not marked as persistent in the dest topic.
>> 
>> I've tried transacted routing but it still doesn't work. I'm using ruby clients over STOMP to send and receive persistent messages via the route:
>> 
>> <broker brokerName="matrixBroker" id="matrixBrokerID" useJmx="true" persistent="true" xmlns="http://activemq.apache.org/schema/core">
>>   <transportConnectors>
>>     <transportConnector uri="tcp://localhost:61616" />
>>     <transportConnector name="stomp" uri="stomp://localhost:61613"/>
>>   </transportConnectors>
>> </broker>
>> 
>> 	<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="matrixBrokerID">
>> 		<property name="brokerURL" value="vm://matrixBroker?create=false"/>
>> 	</bean>
>> 
>> 	<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>> 		<property name="connectionFactory" ref="jmsConnectionFactory"/>
>> 	</bean>
>> 
>> 	<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
>> 		<property name="connectionFactory" ref="jmsConnectionFactory"/>
>> 		<property name="transacted" value="true"/>
>> 		<property name="transactionManager" ref="jmsTransactionManager"/>
>> 	</bean>
>> 
>> 
>> can anyone help please?
>> 
>> thanks,
>> 
>> Alistair
>> 
>> -- 
>> mov eax,1
>> mov ebx,0
>> int 80h
>> 
>> 
>> 
>> 
> 


Re: Disappearing topics in routes

Posted by Alistair Young <al...@uhi.ac.uk>.
forgot to add transacted to the route:

<route>
  <from uri="activemq:topic:src"/>
  <transacted />
  <to uri="activemq:topic:dest"/> 
</route>

but I just get the error:

Invalid content was found starting with element 'transacted'. One of ... expected

Alistair

-- 
mov eax,1
mov ebx,0
int 80h




On 23 Jun 2011, at 12:00, Alistair Young wrote:

> If I declare a route:
> 
> <from uri="activemq:topic:src"/>
> <to uri="activemq:topic:dest"/> 
> 
> when I restart tomcat, the activemq:topic:src is still there as it has persistent messages but the activemq:topic:dest topic disappears along with all messages waiting for durable subscribers in it.
> 
> Camel takes all the messages from dest and puts them in src, and they are all then lost as src is destroyed on restart. Somehow the messages are not marked as persistent in the dest topic.
> 
> I've tried transacted routing but it still doesn't work. I'm using ruby clients over STOMP to send and receive persistent messages via the route:
> 
>  <broker brokerName="matrixBroker" id="matrixBrokerID" useJmx="true" persistent="true" xmlns="http://activemq.apache.org/schema/core">
>    <transportConnectors>
>      <transportConnector uri="tcp://localhost:61616" />
>      <transportConnector name="stomp" uri="stomp://localhost:61613"/>
>    </transportConnectors>
>  </broker>
> 
> 	<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="matrixBrokerID">
> 		<property name="brokerURL" value="vm://matrixBroker?create=false"/>
> 	</bean>
> 
> 	<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
> 		<property name="connectionFactory" ref="jmsConnectionFactory"/>
> 	</bean>
> 
> 	<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
> 		<property name="connectionFactory" ref="jmsConnectionFactory"/>
> 		<property name="transacted" value="true"/>
> 		<property name="transactionManager" ref="jmsTransactionManager"/>
> 	</bean>
> 
> 
> can anyone help please?
> 
> thanks,
> 
> Alistair
> 
> -- 
> mov eax,1
> mov ebx,0
> int 80h
> 
> 
> 
> 


Re: Disappearing topics in routes

Posted by Alistair Young <al...@uhi.ac.uk>.
thanks Ashwin, all working now.

cheers,

Alistair

-- 
mov eax,1
mov ebx,0
int 80h




On 23 Jun 2011, at 20:03, Ashwin Karpe wrote:

> Hi,
> 
> There are several things here
> 
>    a> Are the subscribers truly durable ? 
>        In order to set up a durable subscription on a JMS endpoint, you
> must specify a client ID, which identifies this particular connection, and a
> durable subscription name, which identifies the durable subscriber. For
> example, the following route sets up a durable subscription to the JMS
> topic, news, with a client ID of conn01 and a durable subscription name of
> John.Doe:
> 
> from("activemq:topic:src).
> 
> to(""activemq:topic:dest?clientId=conn01&durableSubscriptionName=John.Doe");
> 
> Also check out this blog. It is pretty instructive
> 
> http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html
> http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html 
> 
>    b> Setting the persistent to "true" makes the broker a persistent broker
> however this is the default behavior of JMS per the JMS spec. The flag is
> interesting when set to "false". Hence you do not buy anything by explicitly
> setting this to true.
> 
>    c> Topics are only persistent if there are Durable subscribers, not
> otherwise... Messages are discarded in the absence of durable subscribers as
> there is no need to preserve them.
> 
> Cheers,
> 
> Ashwin...
> 
> 
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer & Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com 
> 
> Blog: http://opensourceknowledge.blogspot.com 
> CamelOne 2011: http://fusesource.com/camel2011 
> ---------------------------------------------------------
> --
> View this message in context: http://camel.465427.n5.nabble.com/Disappearing-topics-in-routes-tp4517076p4518662.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Disappearing topics in routes

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

There are several things here

    a> Are the subscribers truly durable ? 
        In order to set up a durable subscription on a JMS endpoint, you
must specify a client ID, which identifies this particular connection, and a
durable subscription name, which identifies the durable subscriber. For
example, the following route sets up a durable subscription to the JMS
topic, news, with a client ID of conn01 and a durable subscription name of
John.Doe:

from("activemq:topic:src).
   
to(""activemq:topic:dest?clientId=conn01&durableSubscriptionName=John.Doe");

Also check out this blog. It is pretty instructive
 
http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html
http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html 

    b> Setting the persistent to "true" makes the broker a persistent broker
however this is the default behavior of JMS per the JMS spec. The flag is
interesting when set to "false". Hence you do not buy anything by explicitly
setting this to true.

    c> Topics are only persistent if there are Durable subscribers, not
otherwise... Messages are discarded in the absence of durable subscribers as
there is no need to preserve them.

Cheers,

Ashwin...


-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
CamelOne 2011: http://fusesource.com/camel2011 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Disappearing-topics-in-routes-tp4517076p4518662.html
Sent from the Camel - Users mailing list archive at Nabble.com.