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/21 13:10:29 UTC

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.


RE: activemq-camel: accessing a javax.jms StringProperty ?

Posted by Steve Huston <sh...@riverace.com>.
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.