Given the mentions of JMS and AMQP I would presume that
qpid-jms-client is being used. It will populate the JMSMessageID
header itself during send (unless configured not to) as per the JMS
requirements the field is set by provider-on-send.
Message.setJMSMessageID() (and most other header setters like it) is
exclusively for the use of JMS implementations for handling other
vendors message objects, it is not for applications to use to set a
MessageID on a sent message (if you try, the value will be overwritten
on send with the provider-populated value).

Artemis handles STOMP messages internally using its Core protocol
message objects, so it is presumably converting the AMQP message into
a Core message on the way to the STOMP client. Qpid JMS uses a
string-based message-id field in the underlying AMQP message by
default. Core messages require a UUID message id, and so I expect it
is generating a new one at that conversion point. Qpid JMS can be
configured to use a pure UUID as the underlying AMQP message-id field,
setting URI option jms.messageIDPolicy.messageIDType=UUID . Though
JMSMessageID values must be prefixed with "ID:" so the client will
synthesize that locally for JMSMessageID, meaning you could still then
find that the JMSCorrelationID string you get back on the response
lacks that "ID:" prefix (since the Core JMS client would normally add
that to getJMSMessageID...but you are using a STOMP client).

In fact, ignore all that, as I see the broker is generating a specific
formatted message-id for the STOMP messages. So you simply can't get
the original AMQP message-id on the STOMP receiver.

Your most compatible route in JMS terms would be using the
JMSCorrelationID field to correlate your messages, setting the
JMSCorrelationID value on the request message before sending, getting
that value as the correlation-id on the reciever and setting that
value on the response message before replying, which the requester can
retrieve from JMSCorrelationID again on the response.

As I see others have said already whilst I got interrupted during
typing this reply :)


Robbie

On Thu, 3 Oct 2024 at 16:06, Мурад Байгильдин <baigildi...@gmail.com> wrote:
>
> Hi, Justin!
> Sender sends message into request queue and expects response message in
> response queue, with response's JMSCorellationId header being set to
> message ID that was sent (and could not be read by responder app).
> Sender (java app) originally was not explicitly specifying message ID, not
> really sure if it was set by library used or by the broker
>
> Calling msg.setJMSMessageId(msgId) with some manually generated value did
> reflect on userID property of the message, however it still could not be
> read by responder app via STOMP, unless
> msg.putStringProperty('some-header-name', msgId) was called
>
> As a solution for now we settled on manually putting message ID into string
> properties
>
> чт, 3 окт. 2024 г. в 17:13, Justin Bertram <jbert...@apache.org>:
>
> > Can you clarify your use-case and how the message ID is being set on the
> > client sending the message?
> >
> > Typically the message ID is set by the client implementation or by the
> > broker and it can also change in some circumstances so it's not
> > particularly meaningful to the messaging application. Generally speaking we
> > recommend folks set their own unique ID if they're wanting to track
> > messages.
> >
> >
> > Justin
> >
> > On Thu, Oct 3, 2024 at 2:17 AM Мурад Байгильдин <baigildi...@gmail.com>
> > wrote:
> >
> > > Hi, we ran into an issue when receiving messages via STOMP protocol.
> > > Message was sent by java application using JMSSerializer via AMQP
> > protocol,
> > > resulting in message id being stored in userID message property. When
> > > receiving this message via STOMP, the value of userID was not present in
> > > any header, unless the sender app manually generates an id for the
> > message
> > > and passes it into some custom-named header.
> > > Could not find any related info on this property in the archive.
> > > Maybe it is possible to add a STOMP configuration flag, similar to
> > > stompEnableMessageId (stompEnableUserId e.g.), that would control if a
> > > message's userID value is being passed into STOMP headers?
> > >
> > > artemis version 2.37.0
> > >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@activemq.apache.org
For additional commands, e-mail: users-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to