MQTT Connector, how to read?

0
Nothing is loogged in the console? From where the Payload and Topic is reading?
asked
1 answers
0

Hi Syrine,

Looking at your screenshot, $Topic and $Payload are microflow parameters, not variables that automatically read from the console.

The question is: how is this microflow being called?

In the MQTT Connector, when a message arrives on a subscribed topic, the connector typically invokes a message handler microflow and passes:


Topic (String)

Payload (String)


as input parameters.

So:


$Topic


contains the MQTT topic that received the message, e.g.


sensors/temperature


and


$Payload


contains the message body, e.g.


{"value":25.3}


Your log message:


topic {1} - message {2}


with parameters:


{1} = $Topic

{2} = $Payload


should write something like:


topic sensors/temperature - message {"value":25.3}


to the Mendix Console.

A few things to check:

  1. Log node level
    • Set the log node MqttConnector.LogNode (or your custom log node) to Info or Trace in the Console.
  2. MQTT subscription
    • Verify that the broker connection is successful.
    • Verify that you subscribed to the correct topic.
  3. Message handler microflow
    • Ensure this microflow is actually configured as the callback/action for incoming MQTT messages.
  4. Test with MQTT Explorer
    • Publish a test message:
    • Topic: test/topic
    • Payload: Hello Mendix
    • Then see whether your microflow is triggered.

If you can share the Subscribe activity configuration (or the full MQTT microflow), I can tell exactly where $Topic and $Payload are being populated and why nothing is appearing in the console.



answered