Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

problem when fetching an ObjectMessage from ActiveMQ with a tMomInput

Hi everyone,
I want to fetch messages from ActiveMQ with a tMomInput.
The problem is that the type of my messages is ActiveMQObjectMessage and the only choices I have in talend 4.0.2 are TextMessage, BytesMessage or MapMessage.

And if I select these message types I get cast errors :
Exception in component tMomInput_1
java.lang.ClassCastException: org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to javax.jms.TextMessage
at openagro.openagro1_0_1.openagro1.tMomInput_1Process(openagro1.java:423)
at openagro.openagro1_0_1.openagro1.runJobInTOS(openagro1.java:719)
at openagro.openagro1_0_1.openagro1.main(openagro1.java:593)

Is it possible to use ObjectMessage in talend?
Thanks
Labels (3)
5 Replies
Anonymous
Not applicable
Author

Hello!
I'm running into the same problem. Any news on or ways to work around that?
I think its the producer who sets the type of the message. In my case the messages are produced by a Java/Camel adapter which I can't change.
And the tMOMInput always fails to process these messages.
Thanks,
Felix
Anonymous
Not applicable
Author

Hi,
I eventually created a new component fitting my needs by copying tMOMInput and changing the previous message types by ObjectMessage in the .javajet files.
To understand how the component creation works I read:
https://help.talend.com/search/all?query=How+to+create+a+custom+component
I hope it can help you.
Anonymous
Not applicable
Author

Hi,
I eventually created a new component fitting my needs by copying tMOMInput and changing the previous message types by ObjectMessage in the .javajet files.
To understand how the component creation works I read:
https://help.talend.com/search/all?query=How+to+create+a+custom+component
I hope it can help you.

Hi Cj
Cool, would you like to share your component on Talend exchange?
http://www.talendforge.org/exchange/index.php
Best regards
Shong
Anonymous
Not applicable
Author

Hi cj,
thanks for the pointers.
I tried the same today and although its seems quite straightforward, I'm kind of stuck now.
It works in the Java Debug mode but not in Trace Debug and (basic) Run.
In Trace Debug I get the following exception:
We will consume messages while they continue to be delivered
Exception in component tMomInput3_1
javax.jms.JMSException: Failed to build body from bytes. Reason: java.io.IOException: org.apache.camel.converter.jaxp.StringSource
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:183)
at testprojekt.dd_0_1.dd.tMomInput3_1Process(dd.java:452)
at testprojekt.dd_0_1.dd.runJobInTOS(dd.java:817)
at testprojekt.dd_0_1.dd.main(dd.java:684)
Caused by: java.io.IOException: org.apache.camel.converter.jaxp.StringSource
at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:179)
... 3 more
disconnected
disconnected

This is the relevant implementation of my tMomInput2_begin.javajet file:
/*-----------------------------------------------------------4.judge message body type---------------------------------------*/
...

if ("Text".equals(msgBobyType)) {
...

} else if ("ActiveMQObjectMessage".equals(msgBobyType)) {
%>
String msg_<%=cid %> = null;
if(message_<%=cid%> instanceof org.apache.activemq.command.ActiveMQObjectMessage) {
msg_<%=cid %> = "";
org.apache.activemq.command.ActiveMQObjectMessage mqmsg_<%=cid %> = (org.apache.activemq.command.ActiveMQObjectMessage) message_<%=cid%>;
if(mqmsg_<%=cid %>.getObject() instanceof org.apache.camel.converter.jaxp.StringSource) {
org.apache.camel.converter.jaxp.StringSource ssmsg_<%=cid %> = (org.apache.camel.converter.jaxp.StringSource) mqmsg_<%=cid %>.getObject();
msg_<%=cid %> = ssmsg_<%=cid %>.getText();
}

} else if (message_<%=cid%> instanceof org.apache.activemq.command.ActiveMQTextMessage) {
org.apache.activemq.command.ActiveMQTextMessage mqmsg_<%=cid %> = (org.apache.activemq.command.ActiveMQTextMessage) message_<%=cid%>;
msg_<%=cid %> = mqmsg_<%=cid %>.getText();
}
<%
}

Any help would be really appreciated.
Felix
Anonymous
Not applicable
Author

Hi everyone,
I'm running the same problem. Any news on your ways?
Thanks,
Trinh