You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Robert Dare <ro...@gmail.com> on 2011/08/20 18:01:31 UTC

Using String(json) instead of object as body type:

How does one go about using character/text  body types instead of
object in Camel routes?  Is it as simple as just setting a string in
the producer template?

The ActiveMQ docs indicate that object body types are lowest performance.

Thank you.

Rob

Re: Using String(json) instead of object as body type:

Posted by Robert Dare <ro...@gmail.com>.
Do I need to register a BodyTypeConverter to do this?

On 8/20/11, Robert Dare <ro...@gmail.com> wrote:
> How does one go about using character/text  body types instead of
> object in Camel routes?  Is it as simple as just setting a string in
> the producer template?
>
> The ActiveMQ docs indicate that object body types are lowest performance.
>
> Thank you.
>
> Rob
>

Re: Using String(json) instead of object as body type:

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Aug 20, 2011 at 6:01 PM, Robert Dare <ro...@gmail.com> wrote:
> How does one go about using character/text  body types instead of
> object in Camel routes?  Is it as simple as just setting a string in
> the producer template?
>
> The ActiveMQ docs indicate that object body types are lowest performance.
>

Can you provide a bit more details what you want to do? It sounds as
if you want to route messages from Camel to a ActiveMQ queue.
And that you want to use a javax.jms.TextMessage as the JMS message type?

The Camel JMS endpoint has an option to control that, its the
jmsMessageType option. You can read about it here:
http://camel.apache.org/jms

Here is an example:
.to("activemq:queue:foo?jmsMessageType=Text")


And yes you can also convert the message body to a String type
beforehand as well using the Type Converters
http://camel.apache.org/type-converter.html

.convertBodyTo(String.class)
.to("activemq:queue:foo")

Also there is data format that can convert between types
http://camel.apache.org/data-format


> Thank you.
>
> Rob
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/