ugandhar moturi

ugandhar moturi

  • 2.1k
  • 64
  • 173

How to pass UserName & Password in IBMMQ Client Message

Jul 15 2022 5:46 PM

Hi All,

 I am writing a .NET Console application, our goal is keep a message on the queue and read the message.  the message header should contain User Name  & Password.  I try to pass the Message with below code it is not working.

            hashTable.Add(MQC.HOST_NAME_PROPERTY, strServerName);
            hashTable.Add(MQC.CHANNEL_PROPERTY, strChannelName);
            hashTable.Add(MQC.PORT_PROPERTY, 1414);             
            hashTable.Add(MQC.USER_ID_PROPERTY, "XXXXXX");
            hashTable.Add(MQC.PASSWORD_PROPERTY, "XXXXXX");
            hashTable.Add(MQC.USE_MQCSP_AUTHENTICATION_PROPERTY, true);      
            queueManager = new MQQueueManager(strQueueManagerName,hashTable);         
            queue = queueManager.AccessQueue(requestQueue, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
            requestMessage = new MQMessage();          
            requestMessage.Format = MQC.MQFMT_STRING;
            requestMessage.MessageType = MQC.MQMT_REQUEST;
            requestMessage.Report = MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;
            requestMessage.ReplyToQueueName = responseQueue;
            requestMessage.ReplyToQueueManagerName = strQueueManagerName;
            queuePutMessageOptions = new MQPutMessageOptions();
            queue.Put(requestMessage, queuePutMessageOptions);

In the Message Descriptor it is taking the default value mentioned MQ Server.  it is not takeing my UserName "XXXXX"