SmartsquareGmbH / mqtt-starter

HiveMQ Spring Boot Starter
MIT License
15 stars 5 forks source link

Add support for using suspending methods with `@MqttSubscribe` #13

Closed cmdjulian closed 5 months ago

cmdjulian commented 5 months ago

This pull request adds support for suspending methods in the MqttSubscriberCollector and MqttHandler.
This allows for suspending methods to be used as subscriber methods. For instance:

@MqttSubscribe("test", qos = MqttQos.EXACTLY_ONCE)
suspend fun test(payload: String) {
    ...
}

For the existing calling mechanism based on Method, I changed it to use MethodHandle.
I also added some tests for invoking the handler.