You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dube <er...@gmail.com> on 2012/07/07 04:30:36 UTC

Dynamic queue name from header property.

Hello

I need to dynamically route my messages to queues using camel based off a
header property.  I need to do this in a way where I can append the value of
that header to a high level qualifier (HLQ) and have the message routed to
that queue.  Understanding that I need to add some validation logic,  I've
figured out a way to do this, but it seems kind of messy. Can someone tell
me if there is a more direct way of accomplishing what I'm doing below?

		<route>
			<description>Example Camel Route</description>
			<from uri="activemq:IN.QUEUE?preserveMessageQos=true" />
			<setHeader headerName="FINAL_DESTINATION">
				<simple resultType="java.lang.String">
                                     activemq:queue:HLQ.${in.header.Q_NAME}
                                </simple>
			</setHeader>
			<recipientList delimiter=",">
				<header>FINAL_DESTINATION</header>
			</recipientList>
		</route>

The result I would be expecting is that the producing application sets a JMS
header property Q_NAME.  The route reads that and produces it to a queue
named HLQ.<that value>.

So if the header Q_NAME = OUTPUT.QUEUE then the message would be produced to
HLQ.OUTPUT.QUEUE

Thanks!

--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-queue-name-from-header-property-tp5715644.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic queue name from header property.

Posted by dube <er...@gmail.com>.
Thanks Ben. 


I figured the way I was doing it was overly complex. I had tried it the way
you suggested but must have had a typo somewhere as things were not working
out. 

--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-queue-name-from-header-property-tp5715644p5715656.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic queue name from header property.

Posted by boday <be...@initekconsulting.com>.
you shouldn't need to set/get the extra header value, you can also just do
this...

<route>
    <from uri="activemq:IN.QUEUE?preserveMessageQos=true" />
    <recipientList>
	<simple>activemq:queue:HLQ.${in.header.Q_NAME}</simple>
    </recipientList>
</route>


dube wrote
> 
> Hello
> 
> I need to dynamically route my messages to queues using camel based off a
> header property.  I need to do this in a way where I can append the value
> of that header to a high level qualifier (HLQ) and have the message routed
> to that queue.  Understanding that I need to add some validation logic, 
> I've figured out a way to do this, but it seems kind of messy. Can someone
> tell me if there is a more direct way of accomplishing what I'm doing
> below?
> 
> 		<route>
> 			<description>Example Camel Route</description>
> 			<from uri="activemq:IN.QUEUE?preserveMessageQos=true" />
> 			<setHeader headerName="FINAL_DESTINATION">
> 				<simple resultType="java.lang.String">
>                                     
> activemq:queue:HLQ.${in.header.Q_NAME}
>                                 </simple>
> 			</setHeader>
> 			<recipientList delimiter=",">
> 				<header>FINAL_DESTINATION</header>
> 			</recipientList>
> 		</route>
> 
> The result I would be expecting is that the producing application sets a
> JMS header property Q_NAME.  The route reads that and produces it to a
> queue named HLQ.<that value>.
> 
> So if the header Q_NAME = OUTPUT.QUEUE then the message would be produced
> to HLQ.OUTPUT.QUEUE
> 
> Thanks!
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-queue-name-from-header-property-tp5715644p5715645.html
Sent from the Camel - Users mailing list archive at Nabble.com.