You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yxzhao <yx...@stonewain.com> on 2013/02/13 22:46:47 UTC

Always receive String Message even with jmsMessageType set to Bytes

Hi All,

We have a route which gets messages from an MQ queue. We expect messages in
bytes, but always receive java.lang.String even when we set our route as
below:

 <route id="queue-incoming">
         <from
uri="jmsComponent:queue:test?jmsMessageType=Bytes&amp;disableReplyTo=true"/>                        
         <to uri="bean:imcomingMsgProcessor?method=saveMsg"/>
 </route>

Does anybody have a clue what we did wrong or missing?

Thanks in advance for any help or hints on this issue.



--
View this message in context: http://camel.465427.n5.nabble.com/Always-receive-String-Message-even-with-jmsMessageType-set-to-Bytes-tp5727563.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel as unified communication engine

Posted by Henryk Konsek <he...@gmail.com>.
Hi Ram,

> Is there anyone who has already built a solution like this?

Sounds like a pretty common requirements for the Camel-based solution
:)  Camel deployed on the ServiceMix should suit you more than well.

If you would like to consult any particular aspect of your system,
feel free to ask here as well. We would be happy to assist :) .

> have to take messages and route them to various communication endpoints (as of now, email, sms, social, mobile, web)

If support many endpoints [1] of the box, probably all you need. If
you miss support for the particular technology, you can always create
Jira [2] ticket for it.

Best regards.

[1] http://camel.apache.org/components.html
[2] https://issues.apache.org/jira/browse/CAMEL

--
Henryk Konsek
http://henryk-konsek.blogspot.com

Camel as unified communication engine

Posted by Ra...@cognizant.com.
We are planning to use Camel as a core component for a unified communication engine we are planning to build. Please let us know of any existing work in the space. Basically, from various enterprise system endpoints, we have to take messages and route them to various communication endpoints (as of now, email, sms, social, mobile, web). The solution needs to be highly scalable and cloud friendly.

Is there anyone who has already built a solution like this?

Regards
Ram

Enterprise Architect , Manufacturing Logistics Energy and Utilities - United Kingdom
Technology Consulting Group
Tel : 9840108852 Vnet : 470839
Cognizant
www.cognizant.com


This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.

Re: Always receive String Message even with jmsMessageType set to Bytes

Posted by David Karlsen <da...@gmail.com>.
Oh- of course. I overlooked the fact that it was a consuming route. Btw.
Wmq sets a custom IBM prefixed property defining the sending charset.
Ping me directly if you want me to look it up tomorrow at work where I have
the code.
Den 14. feb. 2013 16:44 skrev "Claus Ibsen" <cl...@gmail.com>
følgende:

> On Thu, Feb 14, 2013 at 4:22 PM, yxzhao <yx...@stonewain.com> wrote:
> > We can verify that if the MQ message is sent with MQMessage.format =
> > MQConstants.MQFMT_STRING, then our route will receive text message.
> > Otherwise, it will receive a byte array. Actually, the sending app uses
> the
> > same write bytes method to put the message into the queue. The same
> message
> > can be received as bytes when using MQMessage.readFully method.
> >
> > Also, we need to know the charset that camel/jms uses to convert the
> bytes
> > into string to revert the text message back to bytes since we need to get
> > the original binary values.
> >
>
> It is not Camel doing anything there. Camel uses the JMS Client to get the
> data.
>
> Camel receives a javax.jms.Message which comes in different
> implementations.
> So Camel check if instanceof TextMessage, then its a text. If
> instanceof BytesMessages its a bytes message  etc.
>
> Under the hood its the JMS client, and in your case IBM WebSphere
> being the JMS client.
>
>
> > Any suggestions?
> >
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Always-receive-String-Message-even-with-jmsMessageType-set-to-Bytes-tp5727563p5727605.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Re: Always receive String Message even with jmsMessageType set to Bytes

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Feb 14, 2013 at 4:22 PM, yxzhao <yx...@stonewain.com> wrote:
> We can verify that if the MQ message is sent with MQMessage.format =
> MQConstants.MQFMT_STRING, then our route will receive text message.
> Otherwise, it will receive a byte array. Actually, the sending app uses the
> same write bytes method to put the message into the queue. The same message
> can be received as bytes when using MQMessage.readFully method.
>
> Also, we need to know the charset that camel/jms uses to convert the bytes
> into string to revert the text message back to bytes since we need to get
> the original binary values.
>

It is not Camel doing anything there. Camel uses the JMS Client to get the data.

Camel receives a javax.jms.Message which comes in different implementations.
So Camel check if instanceof TextMessage, then its a text. If
instanceof BytesMessages its a bytes message  etc.

Under the hood its the JMS client, and in your case IBM WebSphere
being the JMS client.


> Any suggestions?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Always-receive-String-Message-even-with-jmsMessageType-set-to-Bytes-tp5727563p5727605.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Always receive String Message even with jmsMessageType set to Bytes

Posted by yxzhao <yx...@stonewain.com>.
We can verify that if the MQ message is sent with MQMessage.format =
MQConstants.MQFMT_STRING, then our route will receive text message.
Otherwise, it will receive a byte array. Actually, the sending app uses the
same write bytes method to put the message into the queue. The same message
can be received as bytes when using MQMessage.readFully method. 

Also, we need to know the charset that camel/jms uses to convert the bytes
into string to revert the text message back to bytes since we need to get
the original binary values.

Any suggestions?




--
View this message in context: http://camel.465427.n5.nabble.com/Always-receive-String-Message-even-with-jmsMessageType-set-to-Bytes-tp5727563p5727605.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Always receive String Message even with jmsMessageType set to Bytes

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Feb 13, 2013 at 10:46 PM, yxzhao <yx...@stonewain.com> wrote:
> Hi All,
>
> We have a route which gets messages from an MQ queue. We expect messages in
> bytes, but always receive java.lang.String even when we set our route as
> below:
>
>  <route id="queue-incoming">
>          <from
> uri="jmsComponent:queue:test?jmsMessageType=Bytes&amp;disableReplyTo=true"/>
>          <to uri="bean:imcomingMsgProcessor?method=saveMsg"/>
>  </route>
>
> Does anybody have a clue what we did wrong or missing?
>

jmsMessageType is only when Camel sends a message to a queue, where
you can force Camel to send the message as the type you want.

When you receive from a queue, then you receive the message in the
type that it was sent (eg the JMS types).
So in your case, someone send the message as a javax.jms.TextMessage



> Thanks in advance for any help or hints on this issue.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Always-receive-String-Message-even-with-jmsMessageType-set-to-Bytes-tp5727563.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Always receive String Message even with jmsMessageType set to Bytes

Posted by David Karlsen <da...@gmail.com>.
Maybe it becomes converted? What argument type does your bean take? It
should be a byte array
Den 14. feb. 2013 08:27 skrev "yxzhao" <yx...@stonewain.com> følgende:

> Hi All,
>
> We have a route which gets messages from an MQ queue. We expect messages in
> bytes, but always receive java.lang.String even when we set our route as
> below:
>
>  <route id="queue-incoming">
>          <from
>
> uri="jmsComponent:queue:test?jmsMessageType=Bytes&amp;disableReplyTo=true"/>
>          <to uri="bean:imcomingMsgProcessor?method=saveMsg"/>
>  </route>
>
> Does anybody have a clue what we did wrong or missing?
>
> Thanks in advance for any help or hints on this issue.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Always-receive-String-Message-even-with-jmsMessageType-set-to-Bytes-tp5727563.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>