How to set a session ID prefix in ActiveMQ Artemis

75 Views Asked by At

I would like ActiveMQ Artemis to use more meaningful session IDs so that logging like the following would actually mean something:

2023-07-28 13:20:11,486 WARN AMQ222061: Client connection failed, clearing up resources for session 532aa9db-2d37-11ee-b6ee-b42e99304e3c
2023-07-28 13:20:11,487 WARN AMQ222107: Cleared up resources for session 532aa9db-2d37-11ee-b6ee-b42e99304e3c

The connection that this session belongs to has a meaningful client id that we use to differentiate connections from different applications to our brokers. These UIDs in the log however don't tell me anything about which connection created this session which means I can't tell who/what/where caused this problem. I also can't look it up since the session has been "cleared up".

How can I get ActiveMQ Artemis to prefix the session ids with the connections client id?

1

There are 1 best solutions below

0
Justin Bertram On

There's no configuration option to modify the session ID. The only option is to modify the code.

Rather than changing the actual session ID used throughout the code-base (which might have unintended consequences) it would probably be much simpler just to enhance the logging here to include additional details, including the client ID. It could also potentially include the client's IP address, etc.