|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
  |
|
No exception is thrown |
View previous topic :: View next topic |
Author |
Message
|
omar |
Posted: Sun Oct 03, 2004 2:12 am Post subject: No exception is thrown |
|
|
Newbie
Joined: 03 Oct 2004 Posts: 7
|
Hi all,
I am trying to test some special cases, where I can’t put a message to a queue.
When I try to put a message on Queue that configured to inhibit me from putting, no exception is thrown.
Here is my Code
Code: |
try {
MQQueueManager qMngr = new MQQueueManager(“qMannager”);
openPtions = MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE ;
outQueue = qMngr.accessQueue(outQName, openPtions);
MQPutMessageOptions putMessageOptions = new MQPutMessageOptions();
putMessageOptions.options = MQC.MQPMO_SYNCPOINT;
outQueue.put(msg);
} catch (MQException ex) {
ex.printStackTrace();
try {
qMngr.backout();
}
catch (MQException ex1) {
ex1.printStackTrace();
}
return;
}
try {
qMngr.commit();
}
catch (MQException ex) {
ex.printStackTrace();
}
|
Please get easy on me I new to MQ Series.
And if I missed any information please tell me.
Best regards. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Oct 03, 2004 11:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
When I try to put a message on Queue that configured to inhibit me from putting, no exception is thrown. |
And how would you know that ?
First of all your commit is ill placed, it should be right after the put.
Code: |
try {
MQEnvironment = new MQEnvironment();
//set up your environment if client conn or bindings ...
MQQueueManager qMngr = new MQQueueManager(“qMannager”);
openPtions = MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE ;
outQueue = qMngr.accessQueue(outQName, openPtions);
MQPutMessageOptions putMessageOptions = new MQPutMessageOptions();
putMessageOptions.options = MQC.MQPMO_SYNCPOINT;
outQueue.put(msg, putMessageOptions);
qMngr.commit();
} catch (MQException ex) {
System.err.println(ex.getMessage());
ex.printStackTrace();
try {
qMngr.backout();
}
catch (MQException ex1) {
System.err.println(ex1.getMessage());
ex1.printStackTrace();
}
}
return; |
The stack traces are not really informative, try getting the message.
Try not to forget the put message options when putting your message or you are not going to use them...
Where are you setting up you MQEnvironment class ?
That should fix most of your problems.
Enjoy  |
|
Back to top |
|
 |
omar |
Posted: Sun Oct 03, 2004 10:48 pm Post subject: |
|
|
Newbie
Joined: 03 Oct 2004 Posts: 7
|
Quote: |
And how would you know that?
|
I set that Queue to inhibit message putting.
Quote: |
First of all your commit is ill placed, it should be right after the put.
|
It is right after the put !!!!!!!, and on exception I backout the transaction.
Quote: |
Try not to forget the put message options when putting your message or you are not going to use them...
|
I used defoult put options, and with extra option MQC.MQPMO_SYNCPOINT.
Quote: |
Where are you setting up you MQEnvironment class ?
|
I put it at the start of running, and here it is.
Quote: |
// Set the type of connection as TCP/IP
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
// Set Connection Data
MQEnvironment.hostname = “host”;
MQEnvironment.channel = “channel”;
MQEnvironment.port = 1414;
|
fjb_saper, the problem is on putting the message I should receive MQRC_PUT_INHIBITED "2051", because I inhibited that queue from performing MQPUT and MQPUT1 (and that done on Queue settings).
But that don’t happened, why.
Thank you for your reply.
Best regards. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Oct 04, 2004 7:12 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Omar,
You may not have noticed but I changed a lot of the original code you had in my post. So yes you were setting the put options but doing the put without passing the options...
Try changing your code and making it a little bit more comprehensive. You were just outputing the stack trace and not the message. I changed that as well. And please don't be upset if you need to make minor modifications as I did all from memory...
Well enjoy  |
|
Back to top |
|
 |
omar |
Posted: Tue Oct 05, 2004 8:37 am Post subject: |
|
|
Newbie
Joined: 03 Oct 2004 Posts: 7
|
I see that was you code
Sorry for that,
and thank you for your help.
Best regards. |
|
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
|
|
|
|