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

Merged
merged 82 commits into from
Dec 19, 2024
Merged

API Alignment #157

merged 82 commits into from
Dec 19, 2024

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.

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
@DariusIMP DariusIMP requested review from oteffahi and milyin and removed request for oteffahi December 13, 2024 14:01
@DariusIMP DariusIMP mentioned this pull request Dec 13, 2024
Copy link
Contributor

@milyin milyin left a comment

Choose a reason for hiding this comment

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

Looks good, but some options structures doesn't implement setters/getters.

@DariusIMP
Copy link
Member Author

I just changed a couple of things:

  • Added the GetOptions instance on the ZGet example
  • Refactored the Options classes regarding the QoS config

@DariusIMP DariusIMP requested a review from milyin December 18, 2024 21:30
@milyin milyin merged commit 30af980 into eclipse-zenoh:main Dec 19, 2024
8 checks passed
@DariusIMP DariusIMP deleted the alignment branch December 19, 2024 12:54
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.

2 participants