The message ID is set by the JMS client during the send() call per the
JMS spec, it isn't possible for you to set it. As covered in its
documentation, the message.setJMSMessageID() is not for use by
applications, but by JMS implementations (to use when another
implementations message objects are sent).

The PartitionKey 'property' being referred to is I expect a custom
AMQP message-annotation (one I'd guess is not actually named
'PartitionKey'), the JMS client does not surface a way to access
these. The ContentType property is presumably the content-type field
of the AMQP Properties section, the JMS client again does not surface
a way to use this. In these latter two cases, it may be possible to
reach deep into the innards of the Message implementations using
reflection and manipulate it to achieve what you want, but if it is
possible it will be convoluted and brittle.

Robbie

On 20 June 2018 at 14:29, Abhishek Kumar
<mailbox.abhishek.ku...@gmail.com> wrote:
> Hi Team,
>
> I am using "qpid-jms-client-0.33.0" and publishing message to ServiceBus.
>
> We have requirement to set service bus Message Properties like MessageID,
> ContentType, PartitionKey, CorrelationId, ReplyTo.
>
> I am able to set CorrelationId and ReplyTo but not able to set MessageID,
> ContentType and PartitionKey.
>
> Please find below code snippet which i used set properties. Please find
> attached screenshot (ServiceBus_Message_Properties.png).
>
> ContentType - I setted "ContentType" but it is coming as custom properties
> not as a Message Properties.
> PartitionKey - I setted "PartitionKey" but it is coming as custom properties
> not as a Message Properties.
> MessageID - Not reflected at all. Publishing default messageID.
>
> Am i missing something, please suggest your opinion to achieve above
> functionality.
>
> ///Code Snippet///
>
> MessageProducer messageProducer = session.createProducer(destination);
>
> TextMessage textMessage = session.createTextMessage("Hello");
> textMessage.setJMSMessageID("akdhadsajksd-123-1232131");
> textMessage.setObjectProperty("PartitionKey", 333);
> textMessage.setJMSType("application/json");
> textMessage.setObjectProperty("ContentType", "application/json");
>
> Destination replyTo = session.createQueue("connector-test");
> textMessage.setJMSReplyTo(replyTo );
>
> textMessage.setJMSCorrelationID("akdhadsajksd-123-1232131");
>
>
> Regards,
> Abhishek Kumar
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
> For additional commands, e-mail: users-h...@qpid.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to