-
1. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
kcbabo Jun 3, 2013 6:52 AM (in response to tadayosi)Custom message composer or adding a context property are the two options for getting it done now in SY. Specifying properties in the switchyard.xml is a legit use case and it's something we need to do for multiple bindings. I think the best way to do it would be to enhance the default schema for context mappers to allow for value mapping via constants. That way, the same mechanism works for HTTP, SOAP, JMS, etc., etc. If this sounds reasonable, feel free to file a JIRA.
thanks,
keith
-
2. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
tadayosi Jun 5, 2013 6:57 AM (in response to kcbabo)Keith, thanks for your comment! I'd love your suggestion of enhancing the schema for context mappers. I'll try a feature request JIRA soon.
Tadayoshi
-
3. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
tadayosi Jun 5, 2013 7:07 AM (in response to tadayosi)1 of 1 people found this helpfulBy the way, for reference, I could attach a property to outbound JMS messages using the current offerings of SY as follows:
Camel route (route.xml):
<route xmlns="http://camel.apache.org/schema/spring" ...> ... <setHeader headerName="quickstart"> <constant>hello_world_action</constant> </setHeader> <to uri="switchyard://notificationAction" /> </route>
switchyard.xml:
<component name="HelloWorld_ActionESB"> <service name="SimpleListener"> <swyd:interface.esb xmlns:swyd="urn:switchyard-config:switchyard:1.0" inputType="java:java.lang.String" /> </service> <implementation.camel xmlns="urn:switchyard-component-camel:config:1.0"> <xml path="META-INF/route.xml" /> </implementation.camel> <reference name="notificationAction"> <swyd:interface.esb xmlns:swyd="urn:switchyard-config:switchyard:1.0" inputType="java:java.lang.String" /> </reference> </component> <reference name="notificationAction" promote="HelloWorld_ActionESB/notificationAction" multiplicity="1..1"> <jms:binding.jms xmlns:jms="urn:switchyard-component-camel-jms:config:1.0"> <jms:contextMapper includes=".*" /> <jms:queue>quickstart_helloworld_action_Response</jms:queue> <jms:connectionFactory>#ConnectionFactory</jms:connectionFactory> <jms:disableReplyTo>true</jms:disableReplyTo> </jms:binding.jms> </reference>
-
4. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
tadayosi Jul 22, 2013 11:43 PM (in response to kcbabo)Hi Keith,
It's been a while but I finally filed a feature request JIRA at: https://issues.jboss.org/browse/SWITCHYARD-1618
Thank you,
Tadayoshi
-
5. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
rcernich Aug 13, 2013 11:22 AM (in response to tadayosi)1 of 1 people found this helpfulHey all,
I'm taking a look at adding a declarative way for specifying message properties within switchyard.xml. The linked JIRA proposes adding these to the contextMapper element associated with a binding definition. I think this makes good sense.
Regarding the properties, is there a need to specify properties specific to the inbound message, outbound message and context? Or is this overkill?
Internally, there is a mechanism for attaching labels to the properties and some binding types adjust their behavior based on the label associated with the property (e.g. SOAP applies properties labeled as HTTP to the MIME header as opposed to the SOAP header). Given that, should we allow the user to specify labels for each property when declaring them? (I assume these would be defaulted to whatever is sensible for the binding type to which they're applied.)
Putting all of that together might yield a structure like:
<contextMapper> <in> <property name="propertyName" labels="component.soap endpoint.http">propertyValue</property> </in> <out> <property name="propertyName" labels="component.soap endpoint.http">propertyValue</property> </out> <context> <property name="propertyName" labels="component.soap endpoint.http">propertyValue</property> </context> </contextMapper>
Opinions?
Thanks in advance,
Rob
-
6. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
rcernich Aug 19, 2013 4:19 PM (in response to rcernich)I've started sketching out the basic functionality as well as how it might look when integrated into a component binding. The changes can be found in the following branches:
- core - https://github.com/rcernich/core/tree/SWITCHYARD-1618
- components - https://github.com/rcernich/components/tree/SWITCHYARD-1618
The schema changes for contextMapper can be found at [1]. These changes are similar to what is described in the previous post, with the exception that "context" has been renamed "exchange."
The properties are injected via the context mapper, as illustrated by the following (for Camel bindings) at, [2-5]. This means that "in" properties will be associated with the message entering through the binding and "out" properties will be associated with the message exiting through the binding. This implies that "in" properties will be associated with the "in" message for service bindings, but the "out" message for reference bindings (as the message entering the binding is the response).
Regarding labels, if no labels are specified in the configuration, the default labels for the binding are applied to the properties. Labels are specified using a simplified <type>.<name> syntax (e.g. component.soap, behavior.transient, etc.).
Opinions?
Rob
-
7. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
tadayosi Aug 26, 2013 6:09 AM (in response to rcernich)Hi Rob,
Sorry for the late response. I think this enhancement is great. While it may sacrifice some simplicity, it should cover most of the use cases.
Let me ask a couple of questions:
- My understanding is that, say, in a SOAP reference binding, if you declare both "in" and "out" properties in the contextMapper, "in" properties result in SOAP request headers and "out" result in response headers respectively in one request-response conversation (given the default label). Is that correct?
- Is the Properties substitution effective also in the "propertyValue" part?
Thank you,
Tadayoshi
-
8. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
rcernich Aug 26, 2013 10:43 AM (in response to tadayosi)Hey Tadayoshi,
- My understanding is that, say, in a SOAP reference binding, if you declare both "in" and "out" properties in the contextMapper, "in" properties result in SOAP request headers and "out" result in response headers respectively in one request-response conversation (given the default label). Is that correct?
No. That is the way it would behave for a service binding. For a reference binding it would be the opposite: out properties would be applied to the request; in properties to the response.
- Is the Properties substitution effective also in the "propertyValue" part?
Yes, substitutions will apply.
Best,
Rob
-
9. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
kcbabo Aug 26, 2013 9:10 PM (in response to rcernich)This looks cool. A few comments after looking at the examples/code:
- I think the name should be "property", not "header" in the schema.
- Having out represent the request message for outbound and response message for inbound isn't consistent with IN and OUT as they are used with ExchangePhase. I understand that the message is actually moving "out" of the system, but even so that's the in phase of the MEP.
- I don't think any labels should be added by default. Providing the option to specify labels is good though. With that in mind, you may have done this because some components won't pull context properties that don't have a label, in which case that's something we need to discuss. :-)
- Instead of having a protected() method that's explicitly called from context mappers, can we just call super.mapFrom() and super.MapTo() ?
- I have a feeling we will get requests to resolve/evaluate vars in addition to supporting literal values as we have today. Not sure if that would just be an extra attribute on the property element or what.
Thanks for making it easy to review with all the links.
-
10. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
rcernich Aug 28, 2013 11:51 AM (in response to kcbabo)Hey Keith,
Thanks for taking the time to review.
I went with "header" as opposed to "property" because property is already defined in the SwitchYard schema. That said, I don't mind changing the name to something else.
As for the MEP, I just took the easy way out. I'll look to see if I can determine the phase and act accordingly.
As for the labels, I was simply going with how the specific context mappers already applied them. In the case of Camel, it adds those labels already, so I considered that to be "default" for this particular case.
super.map*() works for me. I figured I would need to modify every specialized version anyway, so I went with what was most flexible. I'll move what's there now into the base implementation. I may leave the existing helper method in as well, but I'll know for sure whether or not it needs to be exposed after updating all the component specific context mappers.
Regarding variable evaluation, would that be different than using ${variable:default} notation? If this is not wired in correctly, then I'll get that hooked up. If you meant something different, then I just need clarification on what that means.
Thanks again,
Rob
-
11. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
jorgemoralespou_2 Jul 28, 2014 10:34 AM (in response to tadayosi)What happened to this?
Did it get dropped to get into upstream code?
-
12. Re: What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?
ozkin Jan 31, 2016 12:42 PM (in response to rcernich)Was it taken to the upstream?