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

feat: initial implementation up-java 0.1.11 #1 #2

Conversation

r-vanooyen
Copy link
Contributor

@r-vanooyen r-vanooyen commented Jun 3, 2024

initial implementation of up-client-mqtt-java with up-java 0.1.11 and related up-spec

r-vanooyen and others added 6 commits June 3, 2024 12:27
- dummy implementation
- test setup
- basic pipelines
- documentation
- implementation of send, registerListener and unregisterListener
- added test cases for simple use-cases
- added parsing of all MqttUserProperties to uAttributes in receiving messages use-case
- replaced asserts with proper condition and error handling
…tion-implementation

feat: initial implementation up-java 0.1.11-SNAPSHOT #1
@r-vanooyen r-vanooyen marked this pull request as ready for review June 12, 2024 14:02
Copy link

@stevenhartley stevenhartley left a comment

Choose a reason for hiding this comment

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

Any chance you can add instructions on how to run it with an off the shelf broker?

Choose a reason for hiding this comment

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

Hi @r-vanooyen thank you for the commit. I have a general comment about the way you implemented this transport.

For all other implementations, there is no factory and we implement to a specific communication middleware (ex. vsomeip, zenoh, etc...). I understand that there are many implementations of MQTT5 clients for java and there could be benefits for having a factory HOWEVER I don't think that developers should be exposed with anythign other than specifying which implementation they want the factory to build (HiveMQ, Paho, etc...). That being said the factory should allow you to specify which one you want to build and then return a UTransport object so that we do not need to call anything other than uTransport APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there were 2 ideas behind it

  1. The user of this lib can decide whether he wants to use the hiveMq client or maybe other supported mqtt clients (paho or others)
  2. We as maintainer of the lib do not want to handle all the different mqtt settings a user of the lib might want to choose (ssl, tls, mtls, mqtt-over-websocket, etc.) so we moved the responsibility of setting up the mqtt connection to the user of the lib, and the lib is taking all the responsiblilities and conversions which are defined in uProtocol

I will discuss it Valtech internally, maybe I am the only one with that opinion. If so, I will change it, according to the rust or python implementation

pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
inlined async methods, as the interface methods are now async
removed incorrect copy right
@r-vanooyen r-vanooyen changed the title feat: initial implementation up-java 0.1.10 #1 feat: initial implementation up-java 0.1.11 #1 Jul 17, 2024
LOG.trace("should send a message:\n{}", uMessage);
CompletableFuture<UStatus> result = new CompletableFuture<>();

Mqtt5UserProperties userProperties = Mqtt5UserProperties.builder()

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

As a check too before creating the user properties, you could validate the uAttributes from the uMessage with this validator from up-java.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

most of the uAttributes are defined as NotNull in up-java

image

what should be checked for "value is defined" or not?

Choose a reason for hiding this comment

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

If you look at the uAttributes spec you will see that not every field should be set depending on a message type and within those types not every value is mandatory. uAttributes. It is a good question on how to distinguish between the default value or a set value for uAttributes in java. @stevenhartley do you have any suggestions?

Choose a reason for hiding this comment

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

discussed during the call today to address this

sending messages:
- added validation for uAttributes
- refactor building methods before

receiving message:
- extract source and sink from MqttUserProperties
Copy link

@stevenhartley stevenhartley left a comment

Choose a reason for hiding this comment

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

LGTM, we need to update to v2.0.0 but that can be the next change

@stevenhartley stevenhartley merged commit ffe292c into eclipse-uprotocol:main Aug 1, 2024
1 check passed
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.

3 participants