You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Marx, Peter" <Pe...@knorr-bremse.com> on 2019/05/23 07:16:54 UTC

[solved] activemq-camel: accessing a javax.jms StringProperty ?

indeed, that works! 

I don't understand the background why the camel.Exchange class has less methods than the javax.jms.Message class, but as there is a clever "workaround" I am fine.

Thanks

Peter

-----Original Message-----
From: Steve Huston <sh...@riverace.com> 
Sent: Tuesday, May 21, 2019 3:26 PM
To: users@camel.apache.org
Subject: RE: activemq-camel: accessing a javax.jms StringProperty ?

Camel JMS transfers JMS properties to Camel message headers.
https://stackoverflow.com/questions/22561717/camel-adding-properties-to-a-message-in-spring-dsl
So check exchange.getIn().getHeader(...) in your processor.

-Steve

> -----Original Message-----
> From: Marx, Peter <Pe...@knorr-bremse.com>
> Sent: Tuesday, May 21, 2019 9:10 AM
> To: users@camel.apache.org
> Subject: activemq-camel: accessing a javax.jms StringProperty ?
> 
> i route jms messages to a processor:
> 
>         from("amq:ddbqueue")
>                 .process("convert")
> 	   .to(...)
> 
> The messages have properties which were set on producer side with e.g.
> 
> message.setStringProperty("myprop", "myvalue"); //message is of type 
> javax.jms
> 
> I want to pick up the property in the Processor and set the Exchange 
> header field CamelFileName with the content of the myprop property.
> 
> But I can't find a way to apply something like
> 
> javax.jms.Message inMessage= (org.apache.camel.Message) 
> exchange.getIn();  // cast not possible
> 
> String prop = inMessage.getStringProperty("myprop");          	 // as only
> javax.jms does have the getStringProperty method
> 
> org.apache.camel.Message outMessage=exchange.getOut();
> 
> outMessage.setHeader("CamelFileName",zipFileName);
> 
> 
> Is there a way to access the jms properties ?
> 
> Peter
> 
> 
> 
> Knorr-Bremse Systeme für Schienenfahrzeuge GmbH
> Sitz: München
> Geschäftsführer: Dr. Jürgen Wilder (Vorsitzender), Mark Cleobury, Dr.
> Nicolas Lange, Dr. Peter Radina, Harald Schneider Registergericht 
> München, HR B 91 181
> 
> This transmission is intended solely for the addressee and contains 
> confidential information.
> If you are not the intended recipient, please immediately inform the 
> sender and delete the message and any attachments from your system.
> Furthermore, please do not copy the message or disclose the contents 
> to anyone unless agreed otherwise. To the extent permitted by law we 
> shall in no way be liable for any damages, whatever their nature, 
> arising out of transmission failures, viruses, external influence, delays and the like.


Knorr-Bremse Systeme für Schienenfahrzeuge GmbH
Sitz: München
Geschäftsführer: Dr. Jürgen Wilder (Vorsitzender), Mark Cleobury, Dr. Nicolas Lange, Dr. Peter Radina, Harald Schneider
Registergericht München, HR B 91 181

This transmission is intended solely for the addressee and contains confidential information.
If you are not the intended recipient, please immediately inform the sender and delete the message and any attachments from your system. 
Furthermore, please do not copy the message or disclose the contents to anyone unless agreed otherwise. To the extent permitted by law we shall in no way be liable for any damages, whatever their nature, arising out of transmission failures, viruses, external influence, delays and the like.


Re: [solved] activemq-camel: accessing a javax.jms StringProperty ?

Posted by Andrea Cosentino <an...@gmail.com>.
Camel exchange needs to work with multiple components, so it doesn't make
any sense to have specific methods used only for JMS message. That's why
there is a this "translation" to headers.

Il giorno gio 23 mag 2019 alle ore 09:17 Marx, Peter <
Peter.Marx@knorr-bremse.com> ha scritto:

> indeed, that works!
>
> I don't understand the background why the camel.Exchange class has less
> methods than the javax.jms.Message class, but as there is a clever
> "workaround" I am fine.
>
> Thanks
>
> Peter
>
> -----Original Message-----
> From: Steve Huston <sh...@riverace.com>
> Sent: Tuesday, May 21, 2019 3:26 PM
> To: users@camel.apache.org
> Subject: RE: activemq-camel: accessing a javax.jms StringProperty ?
>
> Camel JMS transfers JMS properties to Camel message headers.
>
> https://stackoverflow.com/questions/22561717/camel-adding-properties-to-a-message-in-spring-dsl
> So check exchange.getIn().getHeader(...) in your processor.
>
> -Steve
>
> > -----Original Message-----
> > From: Marx, Peter <Pe...@knorr-bremse.com>
> > Sent: Tuesday, May 21, 2019 9:10 AM
> > To: users@camel.apache.org
> > Subject: activemq-camel: accessing a javax.jms StringProperty ?
> >
> > i route jms messages to a processor:
> >
> >         from("amq:ddbqueue")
> >                 .process("convert")
> >          .to(...)
> >
> > The messages have properties which were set on producer side with e.g.
> >
> > message.setStringProperty("myprop", "myvalue"); //message is of type
> > javax.jms
> >
> > I want to pick up the property in the Processor and set the Exchange
> > header field CamelFileName with the content of the myprop property.
> >
> > But I can't find a way to apply something like
> >
> > javax.jms.Message inMessage= (org.apache.camel.Message)
> > exchange.getIn();  // cast not possible
> >
> > String prop = inMessage.getStringProperty("myprop");
>  // as only
> > javax.jms does have the getStringProperty method
> >
> > org.apache.camel.Message outMessage=exchange.getOut();
> >
> > outMessage.setHeader("CamelFileName",zipFileName);
> >
> >
> > Is there a way to access the jms properties ?
> >
> > Peter
> >
> >
> >
> > Knorr-Bremse Systeme für Schienenfahrzeuge GmbH
> > Sitz: München
> > Geschäftsführer: Dr. Jürgen Wilder (Vorsitzender), Mark Cleobury, Dr.
> > Nicolas Lange, Dr. Peter Radina, Harald Schneider Registergericht
> > München, HR B 91 181
> >
> > This transmission is intended solely for the addressee and contains
> > confidential information.
> > If you are not the intended recipient, please immediately inform the
> > sender and delete the message and any attachments from your system.
> > Furthermore, please do not copy the message or disclose the contents
> > to anyone unless agreed otherwise. To the extent permitted by law we
> > shall in no way be liable for any damages, whatever their nature,
> > arising out of transmission failures, viruses, external influence,
> delays and the like.
>
>
> Knorr-Bremse Systeme für Schienenfahrzeuge GmbH
> Sitz: München
> Geschäftsführer: Dr. Jürgen Wilder (Vorsitzender), Mark Cleobury, Dr.
> Nicolas Lange, Dr. Peter Radina, Harald Schneider
> Registergericht München, HR B 91 181
>
> This transmission is intended solely for the addressee and contains
> confidential information.
> If you are not the intended recipient, please immediately inform the
> sender and delete the message and any attachments from your system.
> Furthermore, please do not copy the message or disclose the contents to
> anyone unless agreed otherwise. To the extent permitted by law we shall in
> no way be liable for any damages, whatever their nature, arising out of
> transmission failures, viruses, external influence, delays and the like.
>
>