Author |
Message
|
ml_black |
Posted: Mon Mar 22, 2004 8:12 am Post subject: Setting identity context |
|
|
Novice
Joined: 09 Feb 2004 Posts: 20
|
I have used MQOO_SET_IDENTITY_CONTEXT and MQPMO_SET_IDENTITY_CONTEXT. I have a Java application that sets the putApplicationName. I then do MQPUT. The message gets on the queue OK, but the Put Application Name that I set seems to get overridden. Do I need to set rights for my application to be able to set the context? If my app didn't have rights, wouldn't I expect to receive some sort of error message? Any other ideas into why this isn't working? Thanks! |
|
Back to top |
|
 |
vennela |
Posted: Mon Mar 22, 2004 8:37 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Use the options
MQOO_SET_ALL_CONTEXT (in open options)
MQPMO_SET_ALL_CONTEXT (in put message options) |
|
Back to top |
|
 |
ml_black |
Posted: Mon Mar 22, 2004 8:39 am Post subject: |
|
|
Novice
Joined: 09 Feb 2004 Posts: 20
|
OK, but what if I don't want to set all of them--I want the original correlation ID, etc. to persist? Thanks. |
|
Back to top |
|
 |
vennela |
Posted: Mon Mar 22, 2004 8:56 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
To have the correlId generated by QMGR use
Code: |
pmo.options = MQC.MQPMO_SET_ALL_CONTEXT | MQC.MQPMO_NEW_CORREL_ID ; |
AFAIK, that is the only way to set the putApplicationName.
Maybe somebody else knows other ways. |
|
Back to top |
|
 |
ml_black |
Posted: Mon Mar 22, 2004 9:09 am Post subject: |
|
|
Novice
Joined: 09 Feb 2004 Posts: 20
|
Well, I see what you are saying, but what I mean is that I want to GET an existing message off a queue, modify only the Put Application Name, and have all the other MQMD info stay the same. Then I want to PUT it onto another queue. Wouldn't SET_ALL_CONTEXT remove the original info? |
|
Back to top |
|
 |
vennela |
Posted: Mon Mar 22, 2004 9:27 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
I don't see a problem. Use the MQMessage object that you use to get. Change the putApplicationName field. Put the message again using the PMO options.
Code: |
// Get the message
int openOptions1 = MQC.MQOO_INPUT_SHARED ;
MQQueue outQueue = qmgr.accessQueue(QUEUE1 , openOptions1, null, null, null);
MQMessage outMessage = new MQMessage();
outQueue.get(outMessage);
outQueue.close();
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_SET_ALL_CONTEXT ;
MQQueue InQueue = qmgr.accessQueue(QUEUE1 , openOptions, null, null, null);
// Change the putApplicationName field
outMessage.putApplicationName = "My Put Application Name";
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_SET_ALL_CONTEXT ;
InQueue.put(outMessage,pmo); |
|
|
Back to top |
|
 |
ml_black |
Posted: Mon Mar 22, 2004 9:43 am Post subject: |
|
|
Novice
Joined: 09 Feb 2004 Posts: 20
|
OK. Seems to work. Thanks very much! |
|
Back to top |
|
 |
|