One Star

problems using tMomInput with Message Body Type = Map Message

My initial prototype using a tMomInput with Message Body Type = Text Message was successful. Since we plan to pass multi-valued messages, now I'm prototyping Message Body Type = Map Message, but without success. You can see that my AMQ message is JMS, with JSON-encoded product_id.
$ sudo ./bin/activemq-admin browse --amqurl tcp://localhost:61616 product.changed
Java Runtime: Sun Microsystems Inc. 1.5.0_04 /usr/lib/jvm/java-1.5.0.04/jre
Heap sizes: current=1984k free=1628k max=65088k
JVM args: -Dactivemq.classpath=/opt/activemq/conf; -Dactivemq.home=/opt/activemq -Dactivemq.base=/opt/activemq
ACTIVEMQ_HOME: /opt/activemq
ACTIVEMQ_BASE: /opt/activemq
JMS_CUSTOM_FIELD:transformation-error = product_id : product_id
JMS_CUSTOM_FIELD:transformation = jms-map-json
JMS_HEADER_FIELD:JMSDestination = product.changed
JMS_BODY_FIELD:JMSText = {"product_id":5478688}
JMS_HEADER_FIELD:JMSDeliveryMode = non-persistent
JMS_HEADER_FIELD:JMSMessageID = ID:aheinz-49598-1263325250665-4:10:-1:1:1
JMS_HEADER_FIELD:JMSExpiration = 0
JMS_HEADER_FIELD:JMSPriority = 0
JMS_HEADER_FIELD:JMSRedelivered = false
JMS_HEADER_FIELD:JMSTimestamp = 1263327856169
But when I run the job after reconfiguring as a map message, it fails trying to cast an ActiveMQTextMessage to a MapMessage.
Starting job ProductMessage at 15:21 12/01/2010.
connecting to socket on port 3441
connected
Connecting to URL: tcp://localhost:61616
Consuming queue: product.changed
We will consume messages while they continue to be delivered
Exception in component tMomInput_1
java.lang.ClassCastException: org.apache.activemq.command.ActiveMQTextMessage
at lulu_etl.productmessage_0_1.ProductMessage.tMomInput_1Process(ProductMessage.java:355)
at lulu_etl.productmessage_0_1.ProductMessage.runJobInTOS(ProductMessage.java:601)
at lulu_etl.productmessage_0_1.ProductMessage.main(ProductMessage.java:494)

disconnected
Job ProductMessage ended at 15:21 12/01/2010.
Ideas? Is this a bug, or a misconfiguration on my part?
5 REPLIES
One Star

Re: problems using tMomInput with Message Body Type = Map Message

 
Community Manager

Re: problems using tMomInput with Message Body Type = Map Message

Hello
java.lang.ClassCastException: org.apache.activemq.command.ActiveMQTextMessage

There should be a bug, we will refactor tMomxxx component, see 6112. Please add a note on this feature or report a new bug on our bugtracker.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: problems using tMomInput with Message Body Type = Map Message

map message created by StompMessageMap in PHP:
JMS_CUSTOM_FIELD:transformation-error = product_id : product_id
JMS_CUSTOM_FIELD:transformation = jms-map-json
JMS_HEADER_FIELD:JMSDestination = product.changed
JMS_BODY_FIELD:JMSText = {"product_id":5478688}
JMS_HEADER_FIELD:JMSDeliveryMode = non-persistent
JMS_HEADER_FIELD:JMSMessageID = ID:aheinz.rdu.lulu.com-40204-1263845710959-4:4:-1:1:1
JMS_HEADER_FIELD:JMSExpiration = 0
JMS_HEADER_FIELD:JMSPriority = 0
JMS_HEADER_FIELD:JMSRedelivered = false
JMS_HEADER_FIELD:JMSTimestamp = 1264088710853
map message created by tMomOutput
JMS_HEADER_FIELD:JMSExpiration = 0
JMS_HEADER_FIELD:JMSMessageID = ID:aheinz.rdu.lulu.com-42800-1264088975819-0:0:1:1:1
JMS_HEADER_FIELD:JMSPriority = 4
JMS_HEADER_FIELD:JMSDestination = product.changed
JMS_HEADER_FIELD:JMSTimestamp = 1264088976327
JMS_HEADER_FIELD:JMSDeliveryMode = non-persistent
JMS_HEADER_FIELD:JMSRedelivered = false
Reading the 1.1 specification (http://java.sun.com/products/jms/docs.html), it doesn't appear to demand any particular message implementation on the wire. Further reading on the subject suggests that JMS interoperability problems are not uncommon. Talend is using org.apache.activemq Java classes and STOMP purports to be a JMS client for ActiveMQ. I'll keep looking.
One Star

Re: problems using tMomInput with Message Body Type = Map Message

Talend is using org.apache.activemq Java classes

Or perhaps not; it looks like javax.jms.MessageProducer is being used to create the actual message.
One Star

Re: problems using tMomInput with Message Body Type = Map Message

Or perhaps not; it looks like javax.jms.MessageProducer is being used to create the actual message.

Scratch that, javax.jms.MessageProducer is an interface that org.apache.activemq factories are creating instances of.