Skip to content

Load client version in a more reliable way #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
acogoluegnes opened this issue Nov 29, 2017 · 0 comments
Closed

Load client version in a more reliable way #334

acogoluegnes opened this issue Nov 29, 2017 · 0 comments
Assignees
Milestone

Comments

@acogoluegnes
Copy link
Contributor

The current method (property file in the JAR) can cause problem in classpath-sensitive environments like OSGi. com.rabbitmq.client.Connection.class.getPackage().getImplementationVersion() should do the trick.

Mailing list thread: https://groups.google.com/d/msg/rabbitmq-users/f2MdvSeOXLw/5uZT-fcxBQAJ

@acogoluegnes acogoluegnes self-assigned this Nov 29, 2017
@acogoluegnes acogoluegnes added this to the 4.4.0 milestone Nov 29, 2017
@acogoluegnes acogoluegnes changed the title Use Package#getImplementationVersion to get version. Use Package#getImplementationVersion to get version Nov 29, 2017
@acogoluegnes acogoluegnes changed the title Use Package#getImplementationVersion to get version Load client version in a more robust way Dec 11, 2017
@acogoluegnes acogoluegnes changed the title Load client version in a more robust way Load client version in a more reliable way Dec 11, 2017
acogoluegnes added a commit that referenced this issue Dec 11, 2017
The code tries to read the version from a property file
(with a unique name) and falls back to Package#getImplementationVersion
in case of error. If Package#getImplementationVersion fails too,
a default hardcoded value is returned. Warns are logged for every failure.

This should make the retrieval more reliable in different contexts
(e.g. uber-JARs, OSGi).

References #334
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant