Is there a way to get the Correlation Id/ Message Id and store it into the variable? I want to put it into a variable and store it into the database.

I'm thinking of using MQMD.

MQMD *md;

std::string corid = md->CorrelId;

The code above is not functioning.

Please help me with this. BTW, I'm using Websphere MQ for C++.

Thanks! :)

有帮助吗?

解决方案

MessageID, CorrelID and GroupID are all byte arrays. Hence they can't be assigned the way you are trying to. Instead do the following to get messageID. You can try out similarly for CorrelationID and GroupID.

  if ( queue.get( msg, gmo ) ) 
  {
      // Get the message id 
      char byMessageId[24];
      ImqBinary msglId = msg.messageId();

      // Copy the message to a buffer.
      msglId.copyOut(byMessageId,24);
  } 

Hope this helped.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top