Class AbstractMqttIntroductionAdvice<L,M>

java.lang.Object
io.micronaut.mqtt.intercept.AbstractMqttIntroductionAdvice<L,M>
Type Parameters:
L - The listener type
M - The message type
All Implemented Interfaces:
io.micronaut.aop.Interceptor<Object,Object>, io.micronaut.aop.MethodInterceptor<Object,Object>, io.micronaut.core.order.Ordered
Direct Known Subclasses:
Mqtt3IntroductionAdvice, Mqtt5IntroductionAdvice, MqttIntroductionAdvice, MqttIntroductionAdvice

public abstract class AbstractMqttIntroductionAdvice<L,M> extends Object implements io.micronaut.aop.MethodInterceptor<Object,Object>
Intercepts calls to MQTT clients to publish messages.
Since:
1.0.0
Author:
James Kleeh
  • Constructor Details

    • AbstractMqttIntroductionAdvice

      public AbstractMqttIntroductionAdvice(MqttBinderRegistry binderRegistry)
  • Method Details

    • intercept

      public Object intercept(io.micronaut.aop.MethodInvocationContext<Object,Object> context)
      Specified by:
      intercept in interface io.micronaut.aop.MethodInterceptor<L,M>
    • createBindingContext

      public abstract MqttBindingContext<M> createBindingContext(io.micronaut.aop.MethodInvocationContext<Object,Object> context)
      Parameters:
      context - The method context
      Returns:
      The binding context to bind data used in publishing
    • publish

      public abstract Object publish(String topic, M message, L listener)
      Publishes the message.
      Parameters:
      topic - The topic to publish the message to
      message - The message to publish
      listener - The publish action listener
      Returns:
      The result of the publish method
    • createListener

      public abstract L createListener(Runnable onSuccess, Consumer<Throwable> onError)
      Create a listener.
      Parameters:
      onSuccess - The code to call when a message is sent successfully
      onError - The consumer to call in the case of an exception
      Returns:
      A publish action listener
    • getRequiredAnnotation

      public abstract Class<? extends Annotation> getRequiredAnnotation()
      Returns:
      The implement specific client annotation class