You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dshaw <ds...@medata.com> on 2011/07/19 22:08:34 UTC

camel route with temporary queue seems to just hang

I'm still pretty new  to camel and activemq.

//env
java 1.5
spring 3.0.5
camel 2.6.0
activemq 5.4.2

I'm trying to create a route from a regular activemq queue to a temp queue. 
I'm not 100% sure where I'm going wrong.  
If I set my camel route from -> to  to use a regular queue everything works
fine.

I'm thinking I'm missing super simple.  The request, reply works fine using
regular queues.  Any help would be a much appreciated!!

Thanks Dana

//camel-context.xml snip
<route>
<from uri="jms:queue:testin"/>
<to uri="jms:temp:queue:foo"/>
</route>

<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
  <property name="connectionFactory">
    <bean class="org.apache.activemq.ActiveMQConnectionFactory">
      <property name="brokerURL"
value="vm://localhost?broker.persistent=true&amp;broker.useJmx=yes"/>
    </bean>
  </property>
</bean>

///test class
final BeanFactory factory = new XmlBeanFactory(new
FileSystemResource("src/test/resources/META-INF/spring/application.xml"));
		org.springframework.jms.core.JmsTemplate template =
(org.springframework.jms.core.JmsTemplate) factory.getBean("jmsTemplate");
		
		template.send("testin", new MessageCreator() {
		    public javax.jms.Message createMessage(javax.jms.Session session)
throws JMSException {
		    	javax.jms.Message message = (javax.jms.Message)
session.createMessage();
		        message.setStringProperty("myproperty", "hello world!!!");
		        return message;
		      }
		    });
		
		javax.jms.Message recievedMessage = (javax.jms.Message)
template.receive("foo");
		logger.info("recieved 2");
		logger.info("recievedMessage.getJMSMessageID()-->" +
recievedMessage.getJMSMessageID());


--
View this message in context: http://camel.465427.n5.nabble.com/camel-route-with-temporary-queue-seems-to-just-hang-tp4613521p4613521.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel route with temporary queue seems to just hang

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Ashwin and Dana,

I looked up the jms spec for the temp queue API. See:
http://download.oracle.com/javaee/1.4/api/javax/jms/Session.html#createTemporaryQueue%28%29

This clearly shows that you can not specify the name of the temp queue 
when creating it. So I can not imagine it to be used as a named destination.

Christian


Am 20.07.2011 04:35, schrieb Ashwin Karpe:
> Hmm, I am not so sure about that.
>
> The only difference between a temporary and a regular queue is that the
> messages on temporary queues do not outlive the broker and/or active
> connections. If there are no active producers/consumers to the temporary
> destination, the destination is removed by the broker and any messages
> discarded.
>
> I would first try to set the log levels to debug and
>       a>  See if my broker is running and a producer/consumer has been created
> properly by the route.
>       b>  I would create and set up a separate consumer thread listening on
> the temporary queue, thereby guaranteeing that the queue is up and not
> recycled.
>       c>  Then I would send a message via the route.
>
> I would also have a jconsole viewer checking to see if messages are moving
> through the route and queues/topics in ActiveMQ.
>
> Hope this helps.
>
> Cheers,
>
> Ashwin...
>
>
>
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer&  Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com
>
> Blog: http://opensourceknowledge.blogspot.com
> ---------------------------------------------------------
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-route-with-temporary-queue-seems-to-just-hang-tp4613521p4614361.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: camel route with temporary queue seems to just hang

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hmm, I am not so sure about that.

The only difference between a temporary and a regular queue is that the
messages on temporary queues do not outlive the broker and/or active
connections. If there are no active producers/consumers to the temporary
destination, the destination is removed by the broker and any messages
discarded.

I would first try to set the log levels to debug and
     a> See if my broker is running and a producer/consumer has been created
properly by the route.
     b> I would create and set up a separate consumer thread listening on
the temporary queue, thereby guaranteeing that the queue is up and not
recycled. 
     c> Then I would send a message via the route.

I would also have a jconsole viewer checking to see if messages are moving
through the route and queues/topics in ActiveMQ.

Hope this helps.

Cheers,

Ashwin...



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

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/camel-route-with-temporary-queue-seems-to-just-hang-tp4613521p4614361.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel route with temporary queue seems to just hang

Posted by dshaw <ds...@medata.com>.
Thanks again for all of your help!  Man spent way to much time on this.  I
hope after this camel gets easier lol 

--
View this message in context: http://camel.465427.n5.nabble.com/camel-route-with-temporary-queue-seems-to-just-hang-tp4613521p4616547.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel route with temporary queue seems to just hang

Posted by Christian Schneider <ch...@die-schneider.net>.
Yes I am quite sure a temp queue can only be used for replies.

Btw. when you do not set the replyTo option you will automatically use a 
temporary queue.
In fact to not use a reply queue you have to make sure the message 
exchange pattern for the endpoint that sends to jms is InOnly.

Christian


Am 19.07.2011 23:22, schrieb dshaw:
> Thanks for the reply Christian,
> Yea I was a bit confused because the camel documentation describes the jms
> uri as jms:[temp:][queue:|topic:]destinationName[?options].
>
> I'll try the replyTo option and see how that goes.
>
> But just to confirm temporary queues can only be replied to, not as sources
> or destinations?  I've been trying to get this to work for about a day, just
> want to make sure.
>
> Thanks again
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-route-with-temporary-queue-seems-to-just-hang-tp4613521p4613804.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: camel route with temporary queue seems to just hang

Posted by dshaw <ds...@medata.com>.
Thanks for the reply Christian,
Yea I was a bit confused because the camel documentation describes the jms
uri as jms:[temp:][queue:|topic:]destinationName[?options].

I'll try the replyTo option and see how that goes.  

But just to confirm temporary queues can only be replied to, not as sources
or destinations?  I've been trying to get this to work for about a day, just
want to make sure.

Thanks again



--
View this message in context: http://camel.465427.n5.nabble.com/camel-route-with-temporary-queue-seems-to-just-hang-tp4613521p4613804.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel route with temporary queue seems to just hang

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Dana,

as far as I know you can not directly use a temp queue as a destination. 
Temp queues are special in jms as you ask jms to create a temp queue for 
you and then get its name.
So in camel you can use temp queues only for replies. I have no idea why 
there is a temp: syntax in the jms component as I think it can not work.

Another thing are dynamic queues. You just use them like a normal queue. 
The only difference is that the jms server creates it if it is not 
already present.

Christian


Am 19.07.2011 22:08, schrieb dshaw:
> I'm still pretty new  to camel and activemq.
>
> //env
> java 1.5
> spring 3.0.5
> camel 2.6.0
> activemq 5.4.2
>
> I'm trying to create a route from a regular activemq queue to a temp queue.
> I'm not 100% sure where I'm going wrong.
> If I set my camel route from ->  to  to use a regular queue everything works
> fine.
>
> I'm thinking I'm missing super simple.  The request, reply works fine using
> regular queues.  Any help would be a much appreciated!!
>
> Thanks Dana
>
> //camel-context.xml snip
> <route>
> <from uri="jms:queue:testin"/>
> <to uri="jms:temp:queue:foo"/>
> </route>
>
> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
>    <property name="connectionFactory">
>      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>        <property name="brokerURL"
> value="vm://localhost?broker.persistent=true&amp;broker.useJmx=yes"/>
>      </bean>
>    </property>
> </bean>
>
> ///test class
> final BeanFactory factory = new XmlBeanFactory(new
> FileSystemResource("src/test/resources/META-INF/spring/application.xml"));
> 		org.springframework.jms.core.JmsTemplate template =
> (org.springframework.jms.core.JmsTemplate) factory.getBean("jmsTemplate");
> 		
> 		template.send("testin", new MessageCreator() {
> 		    public javax.jms.Message createMessage(javax.jms.Session session)
> throws JMSException {
> 		    	javax.jms.Message message = (javax.jms.Message)
> session.createMessage();
> 		        message.setStringProperty("myproperty", "hello world!!!");
> 		        return message;
> 		      }
> 		    });
> 		
> 		javax.jms.Message recievedMessage = (javax.jms.Message)
> template.receive("foo");
> 		logger.info("recieved 2");
> 		logger.info("recievedMessage.getJMSMessageID()-->" +
> recievedMessage.getJMSMessageID());
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-route-with-temporary-queue-seems-to-just-hang-tp4613521p4613521.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com