I'm trying to receive a JMS message and send it to a MQ queue, keeping
headers on the message.
But headers are sent when using targetClient=1.

So when using the following, no headers are sent.
from("*wmq:queue:A0*").log("${headers}");
template.sendBodyAndHeader("*wmq:queue:A0*", "body", "h1", "headervalue");

However, when having a component called wmqJms (using wmq but without
targetClient=1), it does read headers, even if I have from wmq. But then
when forwarding the message to a wmq component (targetClient=1), there is no
headers on the A1 queue
from("*wmq:queue:A0*").log("${headers}").to("wmq:queue:A1");
template.sendBodyAndHeader("*wmqJms:queue:A0*", "body", "h1",
"headervalue");


public static Component createMQComponent(Properties properties) throws
JMSException {
        JmsComponent jmsComponent = getJmsComponent(properties);
        jmsComponent.setDestinationResolver(new DestinationResolver() {
            @Override
            public Destination resolveDestinationName(Session session,
String destinationName, boolean pubSubDomain) throws JMSException {
                MQQueueSession mqSession = (MQQueueSession) session;
                return session.createQueue("queue:///" + destinationName +
"?targetClient=1");
            }
        });
        return jmsComponent;
    }

    private static JmsComponent getJmsComponent(Properties properties)
throws JMSException {
        return MQComponentBuilder.mqComponent(
                    properties.getPropertyNotNull("wmq.hostname"),
                   
Integer.parseInt(properties.getPropertyNotNull("wmq.port")),
                    properties.getPropertyNotNull("wmq.username"),
                    properties.getPropertyNotNull("wmq.password"),
                    properties.getPropertyNotNull("wmq.queueManager"),
                    properties.getPropertyNotNull("wmq.channel")
            );
    }



--
View this message in context: 
http://camel.465427.n5.nabble.com/JMS-vs-MQ-message-tp5780662.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to