camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: Bridging the ActiveMQ with IBM Websphere using Camel
Date Tue, 23 Sep 2008 08:42:21 GMT
Hi

What version of Camel are you using? There have been a lot of activities on Camel 1.3, 1.4
and 1.5 (in progress). So it's good to know what you use.

Camel-jms will filter out any non JMS-spec valid headers. This is done by iterating the headers
and check if the object type is not a valid one:

See the source: JmsBinding, JmsHeaderFilterStrategy

You set some MQ specific types and thus they are probably filtered out as they are not valid
JMS types. Can't you use String, Integer or the likes? 

Camel sends the JMS message based on the payload type either as a:
TextMessage
ObjectMessage
MapMessage
BytesMessage
...
See source: JmsBinding


What kind of payload are you sending?

We have a ticket for a RFE where you can configure Camel to use a fixed type so you can force
it to send TextMessage.


Try setting DEBUG/TRACE logging to: org.apache.camel.component.jms
And see what it logs

You can also try to set a fixed message to send in your Processor code.

exchange.getIn.setBody("Hello World");
exchange.getIn.setHeader("foo", "bar");


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: JavaRat [mailto:fredrik.sassenberg@mindwell.se] 
Sent: 23. september 2008 10:29
To: camel-user@activemq.apache.org
Subject: Bridging the ActiveMQ with IBM Websphere using Camel


Camel seems too be a most interesting and promising keycomponent in our work
and we have thrown ourselves into trying its potentials. However while
trying to bridge an ActiveMQqueue with an IBM MQ websphere queue we have
discovered the following problem (please see attached picture).

http://www.nabble.com/file/p19623329/camelissue.jpeg camelissue.jpeg 

Messages taken off the Active MQ queue and delivered onto the IBM MQ
Websphere queue which is good and what we want. However the messages will
not have the specific parameters set in the JMS header and it's payload
emptied???
 
Hopefully this is an error from our part but without success we have tried
to locate the faulty code and are now turning too this forum for any advice
or pointers where we are going wrong. (It might be worth mentioning that
this code has worked for us previously using the Servicemix-JMS-Component
which we have tried adapting in the camel approach.)

Our setup is as follows:

CAMEL-CONTEXT.xml
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<package>org.websitename</package>
</camelContext>

<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType">
<util:constant staticfield="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ"/> 
</property>
<property name="queueManager" value="QMgr"/>
<property name="hostName" value="xxx.xxx.xxx.xxx"/>     
<property name="port" value="1414"/>
</bean>
</property> 
</bean>

<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://127.0.0.1:61616" />
</bean>
</property> 
</bean>

MyRouteBuilder.java
public class MyRouteBuilder extends RouteBuilder {

public void configure() {
from("activemq:queue.in").process(new Processor() {
public void process(Exchange exchange) throws Exception {
JmsMessage inMsg = null;

if (exchange.getIn() instanceof JmsMessage) {
inMsg = (JmsMessage)exchange.getIn();
javax.jms.Message inMsgMsg = inMsg.getJmsMessage();

if (inMsgMsg instanceof ActiveMQTextMessage) {
ActiveMQTextMessage inTextMsg = (ActiveMQTextMessage)inMsgMsg;
inTextMsg.setReadOnlyProperties(false);
inMsgMsg.setStringProperty("JMS_IBM_Format", MQC.MQFMT_STRING);
inMsgMsg.setIntProperty("JMS_IBM_MsgType", MQC.MQMT_REQUEST);
}
else {
System.out.println("inMsgMsg not a ActiveMQTextMessage but a " +
inMsgMsg.getClass().toString());
}

}
else {
System.out.println("inMsg not a JmsMessage but a " +
exchange.getIn().getClass().toString());
}

.to("ibmmq:queue.out");

}



A search through forums provided some related clues what might be a problem
in this case???

http://www.nabble.com/Some-headers-are-not-forwarded-to-JMS-destinations-td16763376s22882.html#a16763376

http://www.nabble.com/How-to-avoid-to-lost-Headers-add-from-messages-go-from-activemq---td18381854s22882.html#a18381854

http://www.nabble.com/-CONF--Apache-Camel:-Bean-Binding-(page-edited)-td18903933s22882.html

-- 
View this message in context: http://www.nabble.com/Bridging-the-ActiveMQ-with-IBM-Websphere-using-Camel-tp19623329s22882p19623329.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message