|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Getting 2033 error in GetMessage of reply queue |
« View previous topic :: View next topic » |
Author |
Message
|
anuj1992 |
Posted: Mon Sep 05, 2016 6:19 am Post subject: Getting 2033 error in GetMessage of reply queue |
|
|
Newbie
Joined: 05 Sep 2016 Posts: 2
|
I have to send and receive message with MQ I am able to send and receive message with MQ Explorer.
In MQ Explorer, we created two different queue managers for request and reply on different different ports.
But when I use to connect with Java code in Getmessage I am getting Error code 2033 while get message.
Code: |
import java.io.IOException;
import java.util.Arrays;
import com.ibm.mq.*; // Include the MQSeries classes for Java package
public class MQSapmle {
private String hostname = "[HostName]";
private String channel = "[RequestChannel_Name]";
private String qManager = "[QueueManagerName]";
private MQQueueManager qMgr;
public void init()
{
MQEnvironment.channel = channel;
MQEnvironment.port = 1417;
MQEnvironment.userID = "mqm";
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
} // end of init
public void start() throws Exception
{
try {
// Create a connection to the queue manager
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;
// Now specify the queue that we wish to open, and the open options...
MQQueue system_default_local_queue = qMgr.accessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE", openOptions,null,"in",null);
String Assoc = "test message";
MQMessage request = new MQMessage();
request.writeUTF(Assoc);
request.replyToQueueManagerName="mgr_beta_reply";
request.replyToQueueName="4560";
MQPutMessageOptions pmo = new MQPutMessageOptions();
system_default_local_queue.put(request,pmo);
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = request.messageId;
// Getting Message Id Here returns Message ID
System.out.println("Recieved ID: "+ Arrays.toString(retrievedMessage.messageId));
MQGetMessageOptions gmo = new MQGetMessageOptions();
system_default_local_queue.get(retrievedMessage, gmo);
String msgText = retrievedMessage.readUTF();
System.out.println("The message is: " + msgText);
System.out.println("Is Connection: "+ qMgr.isConnected);
qMgr.disconnect();
}
catch (MQException ex)
{
System.out.println("An MQSeries error occurred : Completion code " + ex.completionCode + " Reason code " + ex.reasonCode);
}
catch (java.io.IOException ex)
{
System.out.println("An error occurred whilst writing to themessage buffer: " + ex);
}
} // end of start
} |
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Sep 05, 2016 8:37 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
A 2033 return code is expected. It means no messages matching criteria...
So you need to make absolutely sure that the MQMD content matches the criteria you are looking for and this before each and every get... i.e. loop iteration. Remember that each get will modify these fields...
And more particularly the following fields
- msgId
- correlationId
- groupId
- sequence #
- Last in sequence
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Sep 05, 2016 9:11 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Did you bother to look up what 2033 actually means?
the command line can help
Code:
mqrc 2033
Once you understand what it means you can start to understand why you are getting it.
There are literally dozens of posts here about this reason code which is not always an error by the way.
Please do not use any SYSTEM.* queue for anything from an application (yes there are exceptions but in general use using these queues is a No-No.).
The Google search option in the upper right of the screen is the place to start searching.
Firstly, is there a path from the first QMGR to the one where the Reply will be written?
Secondly, I'd make it work locally first.
Thirdly, Does the original message get written and COMITTED?
can you browse it using a tool such as RFHUTIL?
What does the MQMD look like?
When you read a message you can specify a timeout period. This allows the system you are going to read the message from to actually do something.
This
Code: |
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;
|
So you are opening the Queue for input and Output?
Not a good idea
use different handles/objects for INput and Output.
I could go on but there is plenty for you to be looking at. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
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
|
|
|
|