Skip to content

Comments

Feat: Send userAgent with client identity#62

Draft
pniedzielski wants to merge 7 commits intobloomberg:mainfrom
pniedzielski:feat/user-agent
Draft

Feat: Send userAgent with client identity#62
pniedzielski wants to merge 7 commits intobloomberg:mainfrom
pniedzielski:feat/user-agent

Conversation

@pniedzielski
Copy link
Collaborator

@pniedzielski pniedzielski commented Nov 25, 2025

@pniedzielski pniedzielski force-pushed the feat/user-agent branch 15 times, most recently from c697852 to 3e77a2f Compare November 25, 2025 23:55
678098
678098 previously approved these changes Jan 16, 2026
This patch teaches session negotiation to send a user agent of the
form "com.bloomberg.bmq(javaXX.YY.ZZ):AA.BB.CC", where "XX.YY.ZZ" is
the version of Java this SDK is running on, and "AA.BB.CC" is the SDK
version.

It additionally sets the user agent to in the `PlainConsumerIT` and
`PlainProducerIT` integration test clients to different strings.
These clients are not simple users of this SDK, and construct the
sockets they communicate on directly.  It is thus useful to
distinguish them on the broker from normal users of the SDK.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
This patch exposes an option in `SessionOptions` that a user can set,
which will be prefixed to the beginning of the user agent sent to the
broker during session negotiation.  This prefix does not need to be
set, but if it is, it must consist only of printable ASCII characters
and must be less than 128 characters long.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
This patch fixes several warnings on JDK 21 and later, in which a
subclass can override a method called from its superclass’s
constructor, letting it see a partially formed `this` object.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
This patch fixes a warning on newer JDKs, where we narrow a `long`
down to an `int` during a compound assignment later on in the
function.  This `long` is the result of the `readByte()` call on the
line changed by this patch, and we might as well store it as an `int`
early on.

    [WARNING] /Users/pniedzielski/Projects/bloomberg/blazingmq-sdk-java/bmq-sdk/src/main/java/com/bloomberg/bmq/impl/infr/proto/MessagePropertiesImpl.java:[234,24] implicit cast from long to int in compound assignment is possibly lossy

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
This patch fixes an implicit conversion from `int` to `byte` that
newer JDKs warn about.

    [WARNING] blazingmq-sdk-java/bmq-sdk/src/main/java/com/bloomberg/bmq/impl/infr/proto/EventHeader.java:[255,31] implicit cast from int to byte in compound assignment is possibly lossy

This is ultimately because bitshifts in Java only operate on integral
types, not bytes, so `typeAsByte` is promoted to a `byte` before being
or’d with `typeSpecificUpdate`.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants