Author |
Message
|
newtomq22 |
Posted: Fri Apr 08, 2005 12:30 pm Post subject: URGENT!!!!Reading a mq message from a queue.. |
|
|
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 |
|
 |
EddieA |
Posted: Fri Apr 08, 2005 3:27 pm Post subject: |
|
|
 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 |
|
 |
fjb_saper |
Posted: Fri Apr 08, 2005 4:22 pm Post subject: |
|
|
 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 |
|
 |
newtomq22 |
Posted: Sun Apr 10, 2005 4:44 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun Apr 10, 2005 4:48 pm Post subject: |
|
|
 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 |
|
 |
newtomq22 |
Posted: Sun Apr 10, 2005 6:29 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun Apr 10, 2005 9:00 pm Post subject: |
|
|
 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 |
|
 |
|