Class MqttInitializer

java.lang.Object
org.chenile.mqtt.init.MqttInitializer

public class MqttInitializer extends Object
Detects the ChenileMqtt annotated classes in the Application Context and populates the mqttConfig for later use by MqttEntryPoint Topic and Qos can be configured at the service level. (not at the operation level)
When a service is subscribed, all operations under the service will be subscribed automatically.
  • Field Details

  • Constructor Details

    • MqttInitializer

      public MqttInitializer(boolean enabled, String basePublishTopic, String baseSubscribeTopic)
  • Method Details

    • init

      @EventListener(org.springframework.boot.context.event.ApplicationReadyEvent.class) @Order(900) public void init() throws Exception
      Throws:
      Exception
    • putAnnotationBackIntoServiceDefinition

      private void putAnnotationBackIntoServiceDefinition(String publishTopic, String subscribeTopic, int qos, String serviceId)
      Put the details of the data structure back into the service definition.
      This is needed since the init method takes default values that are configured in the annotation and mutates them.
      Parameters:
      publishTopic - - the topic to publish when you want to invoke the service remotely
      subscribeTopic - - the topic to subscribe for the service
      qos - - the qos level to subscribe to
      serviceId - - the service Id of the service that gets mapped to the topic and qos