Hi Tim,

Yes, each client has a unique Client ID. And this has been verified.
However, should the Client ID follow a specific pattern?



On Tue, Mar 10, 2026 at 4:17 PM Timothy Bish <[email protected]> wrote:

> On 3/10/26 18:51, John wrote:
> > Hi,
> >
> > I have stumbled across an issue that I believe is with Apache.NMS.AMQP
> > library. I'm using the latest stable version, 2.4.0, for my .NET C#
> service
> > for message handling, with the latest Apache Artemis and Apache ActiveMQ
> > message brokers.
> > Both the web page on Uri Configuration (
> >
> https://activemq.apache.org/components/nms/providers/amqp/uri-configuration
> )
> > and the GitHub project (
> >
> https://github.com/apache/activemq-nms-amqp/blob/main/docs/configuration.md
> )
> > state that "nms.clientId" should be used in the Connection Uri to
> configure
> > the Client ID.
> > However, I have found that using "nms.clientId" breaks consumer
> > functionality for Shared Consumers, who will then receive every message
> in
> > the topic. And that, excluding the query parameter, allows Shared
> Consumers
> > to function correctly, with each consumer receiving only their share of
> the
> > messages.
> > Please also note that if one does not include the parameter in the Uri
> but
> > instead sets the ClientId on the connection object itself, the Shared
> > Customer will still not function correctly, having the same issue as
> using
> > the parameter in the Uri.
> > However, by not including the nms.clientId parameter, a Client ID is
> > automatically generated, which I guess is why it works correctly.
> > Nevertheless, it is less than ideal not being able to use my own Client
> ID.
> > But maybe I'm doing something wrong. Here is some simple example code
> using
> > the nms.clientId parameter that has the issue:
> >
> > static async Task SharedAsync(string clientId, CancellationToken
> > stoppingToken)
> > {
> >      string uri =
> >
> $"amqp://localhost:61616?nms.username=artemis&nms.password=artemis&nms.clientId={clientId}";
>
> Are you giving each client the same ID or are they each being assigned
> there own unique client ID ?
>
>
> >      var connecturi = new Uri(uri);
> >      var factory = new NMSConnectionFactory(connecturi);
> >      using IConnection connection = await
> factory.CreateConnectionAsync();
> >      connection.Start();
> >      using ISession session = await connection.CreateSessionAsync();
> >      ITopic destination = await session.GetTopicAsync("topic-name");
> >      using var consumer = await
> > session.CreateSharedConsumerAsync(destination, "sub-name");
> >      while (!stoppingToken.IsCancellationRequested)
> >      {
> >          var msg = await
> > consumer.ReceiveAsync(TimeSpan.FromMicroseconds(250)) as ITextMessage;
> >          if (msg is not null)
> >          {
> >              // process message
> >          }
> >      }
> > }
> >
> >
> > Thanks,
> > John
> >
>
> --
> Tim Bish
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> For further information, visit: https://activemq.apache.org/contact
>
>
>

Reply via email to