hivemq / hivemq-mqtt-client

HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
https://hivemq.github.io/hivemq-mqtt-client/
Apache License 2.0
855 stars 158 forks source link

How can i config hivemq client as anotation-base with spring boot? #556

Closed UgoTran closed 1 year ago

UgoTran commented 1 year ago

Problem or use case

Currently, i copy code snip on hivemq-client document to connect, Publish, subscribe

Preferred solution or suggestions

Snip code @MqttSubscribe("test_a") public void sub(String topic, MqttMessage message, @Payload String payload, @UserProperties Map properties, @CorrelationData String data) { log.info("receive from : {}", topic); log.info("message payload : {}", new String(message.getPayload(), StandardCharsets.UTF_8)); } Another demo code: https://github.com/tocrhz/mqtt-spring-boot-starter

pglombardo commented 1 year ago

Hi @UgoTran - Unfortunately I don't understand the question. Could you expand or rephrase your question with specifics, code examples and what you are trying to do?

pglombardo commented 1 year ago

Hi @UgoTran since we haven't heard back I'll close out this issue soon. If you still need help let us know!

UgoTran commented 1 year ago

I'm back! i mean, the snip code of an other mqtt-client, that lib support Subscribe a topic by annotation programming style( @MqttSubscribe("topic_name") ).

So, your hivemq-client can be support like that?

pglombardo commented 1 year ago

Welcome back @UgoTran! Great to hear from you.

I think this is what you are looking for: https://github.com/SmartsquareGmbH/mqtt-starter

Aside from that 3rd party project, we don't provide an annotation based API directly in this library.

If that project doesn't help, let me know and we can file this as a feature request that we may be able to add eventually.

pglombardo commented 1 year ago

Hi @UgoTran - I will close out this issue. But if anything remains, feel free to re-open or file another issue. Thanks for pointing this out!