vertx-mqtt
vertx-mqtt copied to clipboard
Unable to unsubscribe from multiple topics at once
Describe the feature
Currently there is an unsubscribe method, which only allows to unsubscribe from a single topic. However, with MQTT you can unsubscribe from multiple topic filters at the same time.
Use cases
Unsubscribe from multiple topics, in a single message.
Yeah, MQTT topic filters are a very important feature, look at the source implementation, it doesn't seem to do this specifically, right?
@ctron would you like to contribute?
I could draft up a PR. However I am not sure I can find the time to follow up on this to get it merged. I think this should come from the project.
Hi @vietj i would like to contribute. Let me know what is the process.
MqttClientImpl Class.
@Override public Future<Integer> unsubscribe(List<String> topics) {
MqttFixedHeader fixedHeader = new MqttFixedHeader(
MqttMessageType.UNSUBSCRIBE,
false,
AT_LEAST_ONCE,
false,
0);
MqttMessageIdVariableHeader variableHeader = new MqttMessageIdAndPropertiesVariableHeader(
nextMessageId(), MqttProperties.NO_PROPERTIES);
MqttUnsubscribePayload payload = new MqttUnsubscribePayload(topics);
io.netty.handler.codec.mqtt.MqttMessage unsubscribe = MqttMessageFactory.newMessage(fixedHeader,
variableHeader, payload);
this.write(unsubscribe);
return ctx.succeededFuture(variableHeader.messageId());
}
Changed the corresponding other classes also.
Tested the same with sample server and client.
you can read these
- https://github.com/vert-x3/.github/blob/478611907c326b37f676db4e3657b19278aa64cb/CONTRIBUTING.md
- https://docs.github.com/articles/github-community-guidelines
happy to have a PR @SivaAkiro