I am new to Camel and am trying to convert a hand-coded bridging router into
the Camel equivalent because - well, we have seen the light ;-)

The router uses a converter and then and exchange pattern.  All working
nicely.

My next task is to inject some headers to assist the consuming clients to
pick the correct messages from the queue.

My trouble is that I cannot quite my head around the method needed to obtain
the data from the object that has the content body:

This is my code with a comment showing where the magic is needed:

package com.toyota.tme.integration.routes;

import com.thoughtworks.xstream.XStream;
import com.toyota.tme.integration.domain.TqsMessage;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.xstream.XStreamDataFormat;

public class RouteFromTQSToApp extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        XStreamDataFormat xStreamDataFormat = new XStreamDataFormat();
        xStreamDataFormat.setXStream(new XStream());

        from("mqseries:AMQD1")
        .convertBodyTo(TqsMessage.class)
// Magic needed here... how do I reference the anonymous 'tqsMessage'
object?
        .setOutHeader(TqsMessage.TQS_META_DATA, tqsMessage.tqsHeader)
        .setOutHeader(TqsMessage.TQS_APPLICATION_ID,
tqsMessage.applicationIdentification.applicationId)
        .setOutHeader(TqsMessage.TQS_APPLICATION_GROUP_ID,
tqsMessage.applicationIdentification.applicationGroupId)
// No further need of wizadry (at least not by me!)
        .inOut()
        .to("activeq:activemq.tqsBridge.FromTqs")
        .marshal(xStreamDataFormat);
    }
}

I guess it has something to do with beanbinding but I just can't grok how to
activate it in this use case!

Any help will be greatly appreciated.

Thanks

Ray
-- 
View this message in context: 
http://old.nabble.com/obtaining-message-header-properties-from-message-body-tp27500730p27500730.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to