1

In my application, I am sending message out to a Websphere MQ queue. Here in the application, users have the flexibility to set the user id in the message. However my problem is, since the parameter is configurable in my application, if users does not set it, from where the value will be taken?

I have gone through the below links, but got little idea about what value will be set for user id if it is not set at application level.

  1. http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.0.1/com.ibm.mq.csqzaw.doc/jm41030_.htm

  2. How to set MQMD ApplicationID field via JMS API?

Any help is appreciated.

Community
  • 1
  • 1
Somnath Musib
  • 3,548
  • 3
  • 34
  • 47

1 Answers1

9

The MQMD.UserIdentifier field is set by the queue manager to the user ID associated with the connection (hConn) that put the message. You can see what this user ID is by looking at DISPLAY CONN or the Applications... display in MQ Explorer.

If your application is running using local bindings, that is, it is on the same machine as the queue manager and it chose not to use a socket, then the user ID that the queue manager will discover is the user ID that the application process is running with.

If your application is running using client bindings, that is, it is using a network conncetion to the queue manager, then the user ID that the queue manager will use is the one assigned to the MCAUSER of the channel connection which can be set by CHLAUTH rules, or security exits, or flowed from the client etc.

If your application is going to set the user ID in the MQMD of the message then the application must tell the queue manager it is going to do this, or whatever is in the MQMD.UserIdentifier field will be over-written with the above. To tell the queue manager it wants to do this, the application must use an additional option when it opens the queue, MQOO_SET_IDENTITY_CONTEXT and when it puts the message, MQPMO_SET_IDENTITY_CONTEXT. The open option also requires you to have the authorization to be allowed to do so, +setid when using setmqaut

Further reading:

Morag Hughson
  • 7,255
  • 15
  • 44