ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Message driven Bean and native (non-JMS) MQ message

Post new topic  Reply to topic
 Message driven Bean and native (non-JMS) MQ message « View previous topic :: View next topic » 
Author Message
WBI_user
PostPosted: Thu Jul 03, 2003 3:56 pm    Post subject: Message driven Bean and native (non-JMS) MQ message Reply with quote

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
View user's profile Send private message
kingdon
PostPosted: Fri Jul 04, 2003 12:45 am    Post subject: Reply with quote

Acolyte

Joined: 14 Jan 2002
Posts: 63
Location: UK

The MQ format value for string format is

Code:

 "MQSTR   "


(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
View user's profile Send private message
yaakovd
PostPosted: Tue Jul 08, 2003 7:27 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
WBI_user
PostPosted: Tue Jul 08, 2003 10:05 am    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

Thanks, MQSTR works
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Message driven Bean and native (non-JMS) MQ message
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.