-
1. Re: Add headers/properties (used as selector in Hornetq topic) to JMS message in Switchyard Camel route
trohovsky Aug 21, 2014 9:11 AM (in response to hoahieusuong)Hi,
try to set the property in the processor by exchange.setProperty("name", "Richard");. This works for me, but maybe also the way how you are setting the property can work. The important thing is to use <jca:contextMapper xsi:type="soap:ContextMapperType" includes="name"/> on the reference. The includes' value is a regexp that is used for matching of properties that will be mapped to out JMS messages. You can set it in the tooling - select your binding -> Message Composer tab -> Includes. Enable message tracing to see if your property is mapped (Domain tab in the SY editor -> select Enable Message Tracing).
Tomas
-
2. Re: Re: Add headers/properties (used as selector in Hornetq topic) to JMS message in Switchyard Camel route
hoahieusuong Aug 21, 2014 11:35 PM (in response to trohovsky)Tomas Rohovsky wrote:
Hi,
try to set the property in the processor by exchange.setProperty("name", "Richard");. This works for me, but maybe also the way how you are setting the property can work. The important thing is to use <jca:contextMapper xsi:type="soap:ContextMapperType" includes="name"/> on the reference. The includes' value is a regexp that is used for matching of properties that will be mapped to out JMS messages. You can set it in the tooling - select your binding -> Message Composer tab -> Includes. Enable message tracing to see if your property is mapped (Domain tab in the SY editor -> select Enable Message Tracing).
Tomas
Great! Thank you, Tomas!
Your instruction is very clearly! I tried to add "includes" as your instruction and it worked perfectly. But i set the property as following:
exchange.getOut().setHeader("name", "Richard");
instead of
exchange.setProperty("name", "Richard");
Thank you again!
HHS
-
3. Re: Add headers/properties (used as selector in Hornetq topic) to JMS message in Switchyard Camel route
hoahieusuong Aug 25, 2014 6:31 AM (in response to trohovsky)Dear Tomas,
I have a question about using regexp in the "includes" attribute on the reference. If i add an exactly name of a property into the "includes" field, this property will be include in the outbound message, but when i use a regexp to match the name of properties as below:
<jms:contextMapper includes="^groupA"/>
(I need all properties have the name started with "groupA" will be included in the outbound message)
This config is not work,
Please give me a help
Thanks
Tomas Rohovsky wrote:
Hi,
try to set the property in the processor by exchange.setProperty("name", "Richard");. This works for me, but maybe also the way how you are setting the property can work. The important thing is to use <jca:contextMapper xsi:type="soap:ContextMapperType" includes="name"/> on the reference. The includes' value is a regexp that is used for matching of properties that will be mapped to out JMS messages. You can set it in the tooling - select your binding -> Message Composer tab -> Includes. Enable message tracing to see if your property is mapped (Domain tab in the SY editor -> select Enable Message Tracing).
Tomas
-
4. Re: Add headers/properties (used as selector in Hornetq topic) to JMS message in Switchyard Camel route
trohovsky Aug 25, 2014 6:53 AM (in response to hoahieusuong)1 of 1 people found this helpfulThe regexp you want to use is "groupA.*".
-
5. Re: Add headers/properties (used as selector in Hornetq topic) to JMS message in Switchyard Camel route
jorgemoralespou_2 Aug 25, 2014 6:53 AM (in response to hoahieusuong)1 of 1 people found this helpfulHi,
I think you should add a .* at the end to match also anything from your "starting with" groupA on, otherwise, it will match only property "groupA".
This is the main class doing the RegExp functionality for the ContextMappers. https://github.com/jboss-switchyard/components/blob/master/common/common/src/main/java/org/switchyard/component/common/composer/BaseRegexContextMapper.java
It is ussing java.util.regex.Pattern to do the pattern matching, so you can easily unit test if your patter shoudl work with whatever you have in the context.
Hope it helps,
-
6. Re: Add headers/properties (used as selector in Hornetq topic) to JMS message in Switchyard Camel route
hoahieusuong Aug 25, 2014 11:22 PM (in response to jorgemoralespou_2)Thank you for your quickly response. It worked!