Skip to content

Add clientId header to all GRPC calls#477

Merged
smcvb merged 2 commits intomainfrom
feature/client-id-header
Feb 24, 2026
Merged

Add clientId header to all GRPC calls#477
smcvb merged 2 commits intomainfrom
feature/client-id-header

Conversation

@CodeDrivenMitch
Copy link
Copy Markdown
Contributor

@CodeDrivenMitch CodeDrivenMitch commented Feb 12, 2026

While implementing the license work for rate limiting and connection limiting, we found it's necessary to uniquely identify an instance of an application. There are, however two problems in the current codebase:

  1. Some GRPC calls have a clientId as body in the message, but not all of them. For example, appending events does not have a clientId.
  2. Users can override the clientId in the AxonServer properties of the framework, making multiple applications count as the same.

This PR introduces the AxonIQ-ClientId header on every GRPC call, so Axon Server can always uniquely identify connections. In addition, the AxonServerConnectionFactory now postfixes the clientId with 8 random characters to enforce uniqueness. Axon Framework applications have only one factory per Axon Server cluster. This should make the limits enforceable.

As this will be used with AS 2026.0.0, I have updated the version of this project to 2026.0.0-SNAPSHOT.

While implementing the license work for rate limiting and connection limiting, we found it's necessary to uniquely identify an instance of an application. There are, however two problems in the current codebase:

1. Some GRPC calls have a clientId as body in the message, but not all of them. For example, appending events does not have a clientId.
2. Users can override the clientId in the AxonServer properties of the framework, making multiple applications count as the same.

This PR introduces the `AxonIQ-ClientId` header on every GRPC call, so Axon Server can always uniquely identify connections. In addition, the AxonServerConnectionFactory now postfixes the `clientId` with 8 random characters to enforce uniqueness. Axon Framework applications have only one factory per Axon Server cluster. This should make the limits enforceable.
Copy link
Copy Markdown
Contributor

@smcvb smcvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes seem fine, build fails, though. And, another question, concerning this:

Some GRPC calls have a clientId as body in the message, but not all of them. For example, appending events does not have a clientId.

Shouldn't this be fixed as well? Is it a misser on the gRPC API, perhaps?

@CodeDrivenMitch
Copy link
Copy Markdown
Contributor Author

@smcvb Thanks for the heads up! I'll take a look at the build.

Shouldn't this be fixed as well? Is it a misser on the gRPC API, perhaps?

This header is actually a replacement for that! Why define this property on call payloads, when we can have it globally as header? This makes it unable to be forgotten, like it happened now.
In the Axon Server code, I will prefer the header over the payload property. Eventually we can remove the client_id from individual calls!

@CodeDrivenMitch
Copy link
Copy Markdown
Contributor Author

The build fails on the javadoc generation of the generated protobuf code... not related to this PR.

image

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@smcvb smcvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concerns have been addressed, hence I'm approving this pull request.

@smcvb smcvb merged commit 317a65e into main Feb 24, 2026
5 checks passed
@smcvb smcvb deleted the feature/client-id-header branch February 24, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants