Class Mqtt5IntroductionAdvice
java.lang.Object
io.micronaut.mqtt.intercept.AbstractMqttIntroductionAdvice<BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,Throwable>,MqttMessage>
io.micronaut.mqtt.hivemq.v5.intercept.Mqtt5IntroductionAdvice
- All Implemented Interfaces:
io.micronaut.aop.Interceptor<Object,
,Object> io.micronaut.aop.MethodInterceptor<Object,
,Object> io.micronaut.core.order.Ordered
@Singleton
@InterceptorBean(MqttPublisher.class)
@Requires(property="mqtt.client.mqtt-version",
value="5",
defaultValue="5")
public class Mqtt5IntroductionAdvice
extends AbstractMqttIntroductionAdvice<BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,Throwable>,MqttMessage>
The MQTT v5 implementation of
AbstractMqttIntroductionAdvice
.- Since:
- 3.0.0
- Author:
- Sven Kobow
-
Field Summary
Fields inherited from interface io.micronaut.aop.Interceptor
ARGUMENT, CACHEABLE_LAZY_TARGET, HOTSWAP, LAZY, PROXY_TARGET
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionMqtt5IntroductionAdvice
(com.hivemq.client.mqtt.mqtt5.Mqtt5AsyncClient mqttAsyncClient, MqttBinderRegistry binderRegistry) -
Method Summary
Modifier and TypeMethodDescriptioncreateBindingContext
(io.micronaut.aop.MethodInvocationContext<Object, Object> context) BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,
Throwable> createListener
(Runnable onSuccess, Consumer<Throwable> onError) Create a listener.Class<? extends Annotation>
publish
(String topic, MqttMessage message, BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult, Throwable> listener) Publishes the message.Methods inherited from class io.micronaut.mqtt.intercept.AbstractMqttIntroductionAdvice
intercept
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.aop.MethodInterceptor
intercept
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
Mqtt5IntroductionAdvice
public Mqtt5IntroductionAdvice(com.hivemq.client.mqtt.mqtt5.Mqtt5AsyncClient mqttAsyncClient, MqttBinderRegistry binderRegistry)
-
-
Method Details
-
publish
public Object publish(String topic, MqttMessage message, BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult, Throwable> listener) Description copied from class:AbstractMqttIntroductionAdvice
Publishes the message.- Specified by:
publish
in classAbstractMqttIntroductionAdvice<BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,
Throwable>, MqttMessage> - Parameters:
topic
- The topic to publish the message tomessage
- The message to publishlistener
- The publish action listener- Returns:
- The result of the publish method
-
createBindingContext
public MqttBindingContext<MqttMessage> createBindingContext(io.micronaut.aop.MethodInvocationContext<Object, Object> context) - Specified by:
createBindingContext
in classAbstractMqttIntroductionAdvice<BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,
Throwable>, MqttMessage> - Parameters:
context
- The method context- Returns:
- The binding context to bind data used in publishing
-
createListener
public BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,Throwable> createListener(Runnable onSuccess, Consumer<Throwable> onError) Description copied from class:AbstractMqttIntroductionAdvice
Create a listener.- Specified by:
createListener
in classAbstractMqttIntroductionAdvice<BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,
Throwable>, MqttMessage> - Parameters:
onSuccess
- The code to call when a message is sent successfullyonError
- The consumer to call in the case of an exception- Returns:
- A publish action listener
-
getRequiredAnnotation
- Specified by:
getRequiredAnnotation
in classAbstractMqttIntroductionAdvice<BiConsumer<com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5PublishResult,
Throwable>, MqttMessage> - Returns:
- The implement specific client annotation class
-