|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Message driven Bean and native (non-JMS) MQ message |
« View previous topic :: View next topic » |
Author |
Message
|
WBI_user |
Posted: Thu Jul 03, 2003 3:56 pm Post subject: Message driven Bean and native (non-JMS) MQ message |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
The environment is WAS V5 with a full MQ V5.3 as the JMS provider. A message driven bean (MDB) is used to get message from the MQ queue.
On the MQ Queue, there is a native MQ message (non-JMS) in XML format.
The MDB onmessage method picks up the message and pass it to the EJB which try to cast it into txtmessage. This failed with "java.lang.ClassCastException: com.ibm.jms.JMSBytesMessage".
So we change the code to cast the message into JMSbytesmessage and there is no error. However it failed in the next step when the DOM XML parser ty to parse the message. This may be because the parser does not know how to handle byte message.
On the MQ queue we can see the full XML message. The MQMD has format MQ_STR. To me this is a text message.
I can use amqsget or amqsgbr to see the full XML message.
My questions are:
1. Is the native MQ message a text message ?
2. When the MDB picks up the non-JMS message , does it change it to JMS before calling the EJB?
3. Is there any configuration on the MDB to tell it how to handle a non-JMS message ?
4. Any idea what my problem may be and how to handle it ? |
|
Back to top |
|
 |
kingdon |
Posted: Fri Jul 04, 2003 12:45 am Post subject: |
|
|
Acolyte
Joined: 14 Jan 2002 Posts: 63 Location: UK
|
The MQ format value for string format is
(that's 3 spaces at the end), not "MQ_STR". If you update the sending application to use the correct value (best to reference the named constant from an MQ header file or equivalent) then JMS should interpret the message as a TextMessage as you were expecting. Good practice would be to always use an instanceof test to confirm the message type before casting it - you never know what might turn up on your queue.
Regards,
James. |
|
Back to top |
|
 |
yaakovd |
Posted: Tue Jul 08, 2003 7:27 am Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
Hi,
It should be TextMessage. Try the following:
Code: |
String txt;
if (message instanceof TextMessage) {
txt = ((TextMessage) message).getText();
} |
[/code] _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
WBI_user |
Posted: Tue Jul 08, 2003 10:05 am Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|