Either the JMS provider accepts these property names and there is no reason for the JMS transport to throw an exception (because this would break existing use cases) or the provider rejects them and will throw an exception (as in Hiranya's original post). Therefore I don't see any reason to modify the JMS transport.
The real problem is that blindly copying transport headers from an incoming to an outgoing message is in general not a good idea and will lead to unexpected results. One can argue that Synapse's default behavior (which is to copy transport headers) is suboptimal, but that's a question of point of view. Andreas On Mon, Jan 31, 2011 at 06:39, Ruwan Linton <[email protected]> wrote: > +1 > I think the fix should be that the JMS transport should throw an exception > in the case of a presence of character '-' in the property names. Rest of it > really belongs to synapse, transport switching scenario. > Ruwan > On Sun, Jan 30, 2011 at 9:09 PM, Amila Suriarachchi > <[email protected]> wrote: >> >> >> On Sat, Jan 29, 2011 at 12:09 PM, Hiranya Jayathilaka >> <[email protected]> wrote: >>> >>> Hi Amila, >>> >>> On Sat, Jan 29, 2011 at 11:45 AM, Amila Suriarachchi >>> <[email protected]> wrote: >>>> >>>> if those properties are not meaning full in JMS then the correct way is >>>> to remove from the synapse layer. Synapse does the jms transport sender >>>> invocation. So it should not send any unrelated stuff. >>> >>> Synapse does not distinguish between different transports. It's a generic >>> mediation layer which interacts with all the transports the same way. So I >>> don't think special casing JMS invocations is a very good solution for >>> Synapse. Also it's not Synapse which invokes the sender. It's the underlying >>> Axis2 engine (see the stack trace). >> >> I did not intended to put that to synapse code. When some one writes a >> synapse configuration he knows he is going to invoke a jms transport. So he >> can remove those headers in his synapse configuration. Synapse In sequence >> (or send mediator) initiates the message sending part. >> >>> >>> It seems it's wrong to have '-' in JMS property names according to the >>> specs and that's why many brokers don't allow that. >> >> If '- 'is not allowed in JMS, even JMS transport should throw an >> exception. JMS transport should not try to make invalid headers to valid >> formats. These invalid headers are given by the synapse configuration. so it >> has to remove them. >> >> thanks, >> Amila. >> >> >>> >>> However some brokers (eg: ActiveMQ) are more flexible in this area. So I >>> think this is something we should fix in the JMS transport level once and >>> for all. WDYT? >>> Thanks, >>> Hiranya >>> >>>> >>>> thanks, >>>> Amila. >>>> >>>> On Fri, Jan 28, 2011 at 10:18 AM, Hiranya Jayathilaka >>>> <[email protected]> wrote: >>>>> >>>>> Hi Folks, >>>>> Many JMS brokers/clients do not allow setting properties with the >>>>> character '-' in the name, on JMS messages. For instance IBM Websphere MQ >>>>> client library throws the following error if this is attempted: >>>>> javax.jms.MessageFormatException: MQJMS1058: Invalid message property >>>>> name: Content-Type >>>>> at >>>>> com.ibm.jms.JMSMessage.newMessageFormatException(JMSMessage.java:4772) >>>>> at com.ibm.jms.JMSMessage.setStringProperty(JMSMessage.java:5771) >>>>> at >>>>> org.apache.synapse.transport.jms.JMSSender.createJMSMessage(JMSSender.java:424) >>>>> at >>>>> org.apache.synapse.transport.jms.JMSSender.sendMessage(JMSSender.java:207) >>>>> at >>>>> org.apache.synapse.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:120) >>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448) >>>>> at >>>>> org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:190) >>>>> at >>>>> org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:174) >>>>> at >>>>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) >>>>> >>>>> In Synapse we set request headers as properties on the outgoing JMS >>>>> message. If the request was received over HTTP, it will probably have a >>>>> few >>>>> headers with the '-' character (Content-Type, Transfer-Encoding etc). So >>>>> this leads to the above error with certain JMS providers. What should be >>>>> the >>>>> correct fix for this? One option is to fix this in JMSSender and replace >>>>> the >>>>> '-' with something like '_' in property names. We can also probably fix >>>>> this >>>>> in Synapse layer by looking at EPR prefix (right now we workaround by >>>>> removing such headers using some mediators). Thoughts? >>>>> Thanks >>>>> -- >>>>> Hiranya Jayathilaka >>>>> Senior Software Engineer; >>>>> WSO2 Inc.; http://wso2.org >>>>> E-mail: [email protected]; Mobile: +94 77 633 3491 >>>>> Blog: http://techfeast-hiranya.blogspot.com >>>> >>>> >>>> >>>> -- >>>> Amila Suriarachchi >>>> WSO2 Inc. >>>> blog: http://amilachinthaka.blogspot.com/ >>> >>> >>> >>> -- >>> Hiranya Jayathilaka >>> Senior Software Engineer; >>> WSO2 Inc.; http://wso2.org >>> E-mail: [email protected]; Mobile: +94 77 633 3491 >>> Blog: http://techfeast-hiranya.blogspot.com >> >> >> >> -- >> Amila Suriarachchi >> WSO2 Inc. >> blog: http://amilachinthaka.blogspot.com/ > > > > -- > Ruwan Linton > Member, Apache Software Foundation; http://www.apache.org > Software Architect & Product Manager, WSO2 Inc.; http://wso2.org > phone: +1 408 754 7388 ext 51789 > email: [email protected]; cell: +94 77 341 3097 > blog: http://blog.ruwan.org > linkedin: http://www.linkedin.com/in/ruwanlinton > google: http://www.google.com/profiles/ruwan.linton > tweet: http://twitter.com/ruwanlinton > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
