Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section contains one example for the MQTT agent.

MQTT Agent

In this workflow example for the MQTT agent


 Image Removed Image Added

MQTT workflow example


The In the above example, the MQTT agent sends any of these 3 UDR types: Error, PublishAck or SubscribeResponse to the Analysis agent, which contains the following code:

Code Block
consume {

...


    debug(input);

...


    if(instanceOf(input, MQTT.SubscribeResponse)){

...


        MQTT.SubscribeResponse resp = (MQTT.SubscribeResponse)input;

...


        MQTT.Publish pub = udrCreate(MQTT.Publish);   

...


        pub.qos = 1;

...


        pub.retain = true;

...


        pub.topic = "test/";

...


        pub.data = resp.data;

...


        udrRoute(pub);

...


    } 

...


}

With this code, the Analysis agent will:

...