So, here is what I currently have as a route:
<camel:camelContext>
<camel:route>
<camel:from uri="direct:gozing/engine/user" />
<camel:to uri="log:com.usamp.CAMEL-BEFORE?level=DEBUG" />
<camel:setHeader headerName="userId">
<camel:simple>
${body.args[0].userId}
</camel:simple>
</camel:setHeader>
<camel:marshal>
<camel:json library="Jackson"/>
</camel:marshal>
<camel:recipientList>
<camel:simple resultType="java.lang.String">
stomp:topic:dm${in.header.userId}
</camel:simple>
</camel:recipientList>
<camel:to uri="log:com.usamp.CAMEL-AFTER?level=DEBUG" />
</camel:route>
</camel:camelContext>
Here are the debug messages, it seems that the body of the message is
wrapped with the "Exchange". How do I send just the body to JMS?
5:19:46.114 engine [qtp794815132-68] DEBUG CAMEL-BEFORE -
Exchange[ExchangePattern: InOut, BodyType:
org.apache.camel.component.bean.BeanInvocation, Body: BeanInvocation public
abstract void
com.usamp.gozing.engine.messaging.producer.user._Producer.onUserEarningEvent(com.usamp.gozing.engine.messaging.event.user.earning.UserEarningEvent)
with [UserEarningEvent{id=0, userId=2, created=null, updated=null,
amount=5, reason='SingleClickOffer', description='Reward for Bubble
Inflatable Couch $38 Shipped'}]]]
15:19:46.530 engine [qtp794815132-68] DEBUG CAMEL-AFTER -
Exchange[ExchangePattern: InOut, BodyType: byte[], Body:
{"args":[{"id":0,"userId":2,"created":null,"updated":null,"amount":5,"reason":"SingleClickOffer","description":"Reward
for Bubble Inflatable Couch $38
Shipped"}],"method":{"name":"onUserEarningEvent","returnType":"void","parameterTypes":["com.usamp.gozing.engine.messaging.event.user.earning.UserEarningEvent"],"exceptionTypes":[],"modifiers":1025,"annotations":[],"parameterAnnotations":[[{}]],"synthetic":false,"typeParameters":[],"declaringClass":"com.usamp.gozing.engine.messaging.producer.user._Producer","declaredAnnotations":[],"genericReturnType":"void","genericParameterTypes":["com.usamp.gozing.engine.messaging.event.user.earning.UserEarningEvent"],"genericExceptionTypes":[],"bridge":false,"varArgs":false,"defaultValue":null,"accessible":false}}]
On Fri, Aug 30, 2013 at 9:57 AM, apara <[email protected]> wrote:
> I guess, I am not quite sure how the routes and expressions are working.
>
> The object which I am sending looks like this:
>
> public class UserEarningEvent {
> private int
> id;
>
> private int
> userId;
>
> ...
> public int getUserId() {
> return userId;
> }
> }
>
> On the other side of the route is a STOMP/WebSocket client, so the message
> content I ultimately want to send is JSON.
>
> So, I am trying the following route:
>
> <camel:camelContext>
> <camel:route>
> <camel:from uri="direct:gozing/engine/user" />
>
> <camel:marshal>
> <camel:json library="Jackson"/>
> </camel:marshal>
>
> <camel:recipientList>
> <camel:simple resultType="java.lang.String">
> stomp:topic:dm${body.userId}
> </camel:simple>
> </camel:recipientList>
> </camel:route>
> </camel:camelContext>
>
> But I am realizing that if I convert the object to JSON format, my
> <camel:simple> expression may not work as expected.
>
> Here is what I actually want to do:
>
> 1) Take the original object of type UserEarningEvent
> 2) Using userId construct a dynamic route
> 3) Send JSON representation to the dynamic route constructed in 2)
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Messages-seem-to-contain-more-than-I-expected-tp5738325p5738326.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>