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 <shus...@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 <peter.m...@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.

Reply via email to