Skip to content
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

API Alignment #157

Open
wants to merge 81 commits into
base: main
Choose a base branch
from
Open

API Alignment #157

wants to merge 81 commits into from

Conversation

DariusIMP
Copy link
Member

@DariusIMP DariusIMP commented Dec 11, 2024

This PR extensively updates the Zenoh Java API.

Api modifications:

Removing all builder patterns and resolvables

We noticed this kind of API was causing confusions among Java users:

publisher.put(payload).attachment(attachment).res();

For 2 reasons:

  • the imperativeness of statements such as "put" doesn't make you think it's in fact returning a builder
  • the .res() call was often forgotten

It was decided to go for an approach similar to the C++'s bindings with Option objects, for instance:

PublisherOptions options = new PublisherOptions();
options.setEncoding(Encoding.ZENOH_STRING);
options.setReliability(Reliability.RELIABLE);
Publisher publisher = session.declarePublisher(keyExpr, config);

New features introduced:

  • Scouting
  • Liveliness
  • ZBytes (replacing Value)
  • SessionInfo

Documentation:

All the documentation was updated with examples following the new API.

Misc:

Logger refactoring

Logs can now be achieved by running for instance:

RUST_LOG=debug gradle ZGet

similar to other Zenoh bindings.

Packages reordering

  • Aligning the sorting of classes and packages with the other bindings

Adding new examples

  • Added examples: Zping, ZPong, ZScout

  • Also providing argument handling to them with 'picocli'.

Encoding updates

Internal:

  • Porting tests from kotlin to java
  • Adoption of the "@JvmOverload" tag

Missing items

ZBytes serialization and deserialization utilities, to be added in a followup PR.

…allback subclasses + tidying up documentation.
Copy link

PR missing one of the required labels: {'bug', 'internal', 'documentation', 'breaking-change', 'new feature', 'enhancement', 'dependencies'}

@DariusIMP DariusIMP added documentation Improvements or additions to documentation enhancement New feature or request release Part of the next release labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request release Part of the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant