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

Remove the MQTT Client dependency from the factory #4

Open
stevenhartley opened this issue Jul 31, 2024 · 0 comments
Open

Remove the MQTT Client dependency from the factory #4

stevenhartley opened this issue Jul 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@stevenhartley
Copy link

The current design requires you to create a MQTT client implementation specific object outside of the factory and then inject it into the factory for a specific type which makes the factory methods specific and requires the clients to work with and depend on the specific MQTT5 client implementation, see example code below:

Mqtt5Client mockedClient = mock(Mqtt5Client.class);
var result = TransportFactory.createInstance(mock(UUri.class), mockedClient);

It is Ok that up-transport-mqtt5-java could support multiple client implementations other than HiveMQ (ex. paho) however the factory method should be generic such that we simply state what type we want to createInstance() of and/or also provide a default that returns a default instance of a client. In order to do this, we need to generalize the configuration options passed to MQTT5 clients in a configuration file starting with username + password but then eventually support passing certificates once we test the client for a given broker like Azure.

then the API would be something like:

// Generalized MQTT configuration like username & password
MqttConfig config; 

// uE source address
UUri source;

UTransport transport = Mqtt5TransportFactory.createInstance(source, config);
@stevenhartley stevenhartley added the enhancement New feature or request label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant