Question

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! :)

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top