A basic rework of the API using Promises and PushStreams #420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds an example API based purely on Promises and PushStreams. It removes the lifecycle and callback management from the MQTTToken, using it instead as a holder for static information. This allows the API to be simplified quite a lot, and for the API to start using immutable types when calling back into client code.
The new API is in the
org.eclipse.paho.mqttv5.client.alpha package
, and theMqttAsyncClient
is a simple adapter from the old API to the alpha API. Everything should be using generics to ensure type safety, but I'm sure that a more optimal implementation would be possible with some work in the core code.There is a simple example of using the code in the test client. As per my comments in issue #389 I'm happy to answer questions, and I thought a concrete example of using Promises/streams might prove helpful.
Signed-off-by: Tim Ward [email protected]