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 » URGENT!!!!Reading a mq message from a queue..

Post new topic  Reply to topic
 URGENT!!!!Reading a mq message from a queue.. « View previous topic :: View next topic » 
Author Message
newtomq22
PostPosted: Fri Apr 08, 2005 12:30 pm    Post subject: URGENT!!!!Reading a mq message from a queue.. Reply with quote

Novice

Joined: 08 Apr 2005
Posts: 24

Hi,

I am trying to read a message from the queue.I cast it to TextMessage and then write it to a error log file.But when i try to cast it it gives me a class cast exception

java.lang.ClassCastException: com.ibm.jms.JMSBytesMessage

All i am doing is

Message errorMsg = errorReceiver.receive(1);

if(errorMsg != null) {
System.out.println("logging error message " + errorMsg.getJMSMessageID());
MsgLogger.logRejectedMsg(((TextMessage) errorMsg).getText());

This is only happening for the msgs on the error queue. The msgs on the inbound queue cast to text message fine.The party which is sending us these messages says that they haven't changed anything, they send the same type of messages to the publish inbound queue and the error inbound queue.
Do i need to change the configuration for this error queue?I am totally stuck.Please help, this is URGENT!!

TIA
Back to top
View user's profile Send private message
EddieA
PostPosted: Fri Apr 08, 2005 3:27 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
This is only happening for the msgs on the error queue

What is writing the messages to the error queue. It looks like it might be changing something in the MQMD, or RFH2 (if there is one), when it transfers the message.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Apr 08, 2005 4:22 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

My guess is with Error queue he is referring to the qmgr's DLQ
There is an extra header on there.
The message type will be a BytesMessage and you have to first extract the DLQ header before you can get to the Text payload.

Enjoy
Back to top
View user's profile Send private message Send e-mail
newtomq22
PostPosted: Sun Apr 10, 2005 4:44 pm    Post subject: Reply with quote

Novice

Joined: 08 Apr 2005
Posts: 24

i am new to MQseries so please bear my ignorance.
What does DLQ mean and how can i extract the DLQ from the message?
But this is happening only for msgs coming in the error queue and from your response it looks like this DLQ is a qmgr's property, but wouldn't then the inbound q also be affected?

The error queue is configured same as the inbound queue. When we sent a "REQUEST" message, if it passes on the other end they sent us back a "PUBLISH" message to the inbound queue and if they see any error they sent our message back with a error feedback section to this error queue. They say that there is no difference between the msg they sent to the inbound q and the error q.

As Eddie says that
It looks like it might be changing something in the MQMD, or RFH2 (if there is one),

but how can i confirm that?I need to confirm from my side before asking them that question.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Apr 10, 2005 4:48 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Forget about the RFH2 this is JMS, the RFh2 header does not affect the message type.

DLQ means Dead Letter Queue. Any message being put by the qmgr on the DLQ gets a DLQ header. Thus it moves from txt message to BytesMessage.

Enjoy
Back to top
View user's profile Send private message Send e-mail
newtomq22
PostPosted: Sun Apr 10, 2005 6:29 pm    Post subject: Reply with quote

Novice

Joined: 08 Apr 2005
Posts: 24

but i don't think it's a dead letter q ( i will confirm for you tomorrow)
If it's not a DLQ what do u think could be the other reason for the msg being BytesMessage?

and how can i remove the DLQ header and read the textload?

Thanks a lot for the previous reply,
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Apr 10, 2005 9:00 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Now if your message source is not a JMS source and the put did not specify in the MQMD a format of MQSTR you may have what is called a "raw" message.

Any message from a non JMS source that did not specity MQSTR as a format in the MQMD or that has an additional header (other than RFH) will not cast to a text message. You should try reading those as BytesMessages.

You may have to determine the type of header and the number of bytes of the header by reading the first x bytes of the header. This should allow you to get at the text payload. Treat it as a string buffer and append the bytes.

Remember just like when waiting at a railroad crossing. "One header can hide another"

Enjoy
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » URGENT!!!!Reading a mq message from a queue..
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.