rabbitmq / rabbitmq/rabbitmq-java-client

Changed ClientProperty after recovery in connection.created message

Open
#861 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
587
Avg merge
7h 29m
Merged PRs (30d)
41

Description

Hello,

We are using this version
com.rabbitmq
amqp-client
5.15.0

But 3.16.0 hasn't changed in the following regards.

We are facing the issue that we need a unique identifier that should change after each connection incl. automatic recovery.
That's why we added this UUID into the clientProperties of the connection via ConnectionFactory.
Everything works but the initial connection.created message the rabbit server is sending after a recovery.
Here we see the old UUID still.
We tried to change the property in the recoveryStarted call.

But when I look into the source code, we don't have any chance to do this.

AutorecoveringConnection stores params, which are not accessible from outside but in parts through a delegate that is created as RecoveryAwareAMQConnection using this params.
Unfortunately they are stored as a new HashMap in AMQConnection:
this._clientProperties = new HashMap(params.getClientProperties());
As well as whole as params in RecoveryAwareAMQConnectionFactory.

The AutorecoveringConnection.recoverConnection is calling the internal ConnectionFactory (not ours) to create a newConnection which is using the stored params, which is not accessible for us.

As I previously said, the first call of recoveryStart is too late for us to make any modification, because we need this changed clientProperty in the first communication (connection.created message) that is made before any channel activity.

Or is there a way to do this anyhow?
In my small opinion the clientProperties of the delegate of the current connection should be used for the new connection instead of the initially stored params of the factory.

Kind regards,
Markus Heidt

I know, I hate those cases as well :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing AutorecoveringConnection.recoverConnection and the internal ConnectionFactory path into RecoveryAwareAMQConnectionFactory and AMQConnection. Compare the stored params with the delegate's client properties, focusing on the first connection.created message after recovery. Done means the intended client property is available in that initial post-recovery communication, with behavior verified by an appropriate client test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.