stream connection name

55 views
Skip to first unread message

janezj

unread,
May 6, 2022, 9:55:08 AM5/6/22
to rabbitmq-users
Hi I am using Stream JavaClient. I would like to name the connection to be visible in the management, is there a magic property required to be set in EnvironmentBuilder?

Thanks, jj

Arnaud Cogoluègnes

unread,
May 9, 2022, 2:54:45 AM5/9/22
to rabbitmq-users
It's not possible to choose the name of connections in the stream Java client. Note the client does not use only one connection, so if the feature were to be added, it should be through an abstraction like "connection naming strategy".

Currently the client uses prefixes for the type of connections (producer, consumer, etc) and sequences [1]. It's possible to expose this mechanism in a public API.

Please provide more information about your use case to make sure it's worth it. Thanks.

janezj

unread,
May 9, 2022, 8:25:31 AM5/9/22
to rabbitmq-users
This is my consumer (clojure), I have two apps consuming my-stream. Both apps are also producing messages, so I would like to set name or part of the name during building of Environment, Consumer, and Producer.


(defn consumer []
  (pmsg-on "rabbit-stream/stream" true)
  (dot/.. (Environment/builder)
    (uri (:mq-stream config))
    (build)
    (consumerBuilder)
    (stream "my-stream")
    (offset (OffsetSpecification/last))
    (messageHandler handler)
    (build))

Arnaud Cogoluègnes

unread,
May 9, 2022, 10:26:01 AM5/9/22
to rabbitmq-users
You want to differentiate the connections of the different applications, is that right?

Currently, an environment instance creates connections with names like rabbitmq-stream-locator-0, rabbitmq-stream-producer-0, rabbitmq-stream-consumer-0, etc. Depending on the needs, it will create new connections and the sequences at the end of the names will increment (rabbitmq-stream-locator-1, etc).

You'd like to specify maybe an ID for the environment instance and this ID would be used as a prefix in the connection names? So the connection names could be my-first-app-locator-0, my-first-app-producer-0, my-first-app-consumer-0 when the ID is set to "my-first-app" on the first environment instance and my-second-app-locator-0, my-second-app-producer-0, my-second-app-consumer-0 when the ID is set to "my-second-app" on the second environment instance. Does that sound OK?

janezj

unread,
May 10, 2022, 4:20:44 AM5/10/22
to rabbitmq-users
Yes, this is a great solution to my problem.

Arnaud Cogoluègnes

unread,
May 10, 2022, 8:11:43 AM5/10/22
to rabbitmq-users
OK, thanks for the feedback, I created a follow-up issue [1].

janezj

unread,
May 10, 2022, 8:38:32 AM5/10/22
to rabbitmq-users
Thank you

Arnaud Cogoluègnes

unread,
May 10, 2022, 10:42:47 AM5/10/22
to rabbitmq-users

janezj

unread,
May 11, 2022, 4:32:37 AM5/11/22
to rabbitmq-users
I have trouble fetching jar from repo. Could you please post an url of the jar in your maven repo.

janezj

unread,
May 11, 2022, 5:01:47 AM5/11/22
to rabbitmq-users
"id" is quite misleading, how about prefix?

janezj

unread,
May 11, 2022, 6:06:14 AM5/11/22
to rabbitmq-users
It is working, no need for url. Thanks
Reply all
Reply to author
Forward
0 new messages