0

I am writing an activemq producer in C++, which is writing a map message to an activemq queue on .net platform. I am using the NMSXGroupID (of the ActiveMQMapMessage type) to route the message accordingly on the .net side when I am consuming the same message.

    private MyBytesMessage GetMyMessage(IMessage sourceMsg)
    {
        if (sourceMsg == null)
            return null;

        MyBytesMessage myMessage = null;
        ActiveMQMapMessage bMessage = sourceMsg as ActiveMQMapMessage;
        if (bMessage != null)
        {
            if (bMessage.Body.Keys.Count > 0)
            {
                byte[] messageBody = bMessage.Body.GetBytes("body") as byte[];
                if (messageBody != null)
                {
                    myMessage = new MyBytesMessage(messageBody);
                    myMessage.MessageGroupID = bMessage.NMSXGroupID;
                }
            }
        }
        return myMessage;
    }

I want to set the same id from the C++ side, when I am writing the message.

bhavesh
  • 1,343
  • 2
  • 14
  • 23

1 Answers1

1

Since the C++ ActiveMQ client implements the CMS API which allows for you to set the group ID values via the message property accessors. You can check the connection metadata class for the list of all properties that can be used just like in JMS.

To set the group ID value you need to use the JMSXGroupID property like so:

  message->setStringProperty("JMSXGroupID", GROUPID);
Tim Bish
  • 17,475
  • 4
  • 32
  • 42