axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiranya Jayathilaka <hiranya...@gmail.com>
Subject Re: Problem with JMS Transport
Date Tue, 01 Feb 2011 17:43:03 GMT
Hi Indika,

On Tue, Feb 1, 2011 at 5:53 PM, indika kumara <indika.kuma@gmail.com> wrote:

> Is that the same for the other headers that axis2 knowns such as Content
> Encoding?  So the issue is with the custom headers (i.e headers axis2 does
> not know) ?  Am I correct?  if so I agree with Andreas.
>

Synapse copies all incoming request headers to the outgoing request.
Basically it copies over the entire TRANSPORT_HEADERS map. In case of JMS,
the transport attempts to set transport headers on the JMS message as JMS
properties. This leads to the exception mentioned in my first mail with HTTP
headers like Content-Type, Content-Encoding, Transfer-Encoding etc.

Thanks,
Hiranya


>
> BTW,  an optional filtering or intercepting mechanism for the headers at
> the transport layer may be useful.
>
> ~ indika
>
>
> On Tue, Feb 1, 2011 at 12:01 PM, Andreas Veithen <
> andreas.veithen@gmail.com> wrote:
>
>> That is how it works for the content type header.
>>
>> Andreas
>>
>> On Tue, Feb 1, 2011 at 12:18, indika kumara <indika.kuma@gmail.com>
>> wrote:
>> > isn't the following mapping is suitable ?
>> >
>> > (In transport's specific headers) -> (Axis2 internal representations) ->
>> > (Out transport's specific headers )
>> >
>> > ~ Indika
>> >
>> > On Tue, Feb 1, 2011 at 7:55 AM, Andreas Veithen <
>> andreas.veithen@gmail.com>
>> > wrote:
>> >>
>> >> 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 <ruwan.linton@gmail.com>
>> >> 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
>> >> > <amilasuriarachchi@gmail.com> wrote:
>> >> >>
>> >> >>
>> >> >> On Sat, Jan 29, 2011 at 12:09 PM, Hiranya Jayathilaka
>> >> >> <hiranya911@gmail.com> wrote:
>> >> >>>
>> >> >>> Hi Amila,
>> >> >>>
>> >> >>> On Sat, Jan 29, 2011 at 11:45 AM, Amila Suriarachchi
>> >> >>> <amilasuriarachchi@gmail.com> 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
>> >> >>>> <hiranya911@gmail.com> 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: hiranya@wso2.com;  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: hiranya@wso2.com;  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: ruwan@wso2.com; 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: java-dev-unsubscribe@axis.apache.org
>> >> For additional commands, e-mail: java-dev-help@axis.apache.org
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>


-- 
Hiranya Jayathilaka
Senior Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Mime
View raw message