Configure MQTT client with mosquitto broker

0
Hi, I want to connect mosquitto broker through the Mqtt Client connector,which is available in appstore. But there is no enough documentation to do so. Can anyone guide me to configure this?   Thanks in advance
asked
3 answers
3

Hi Melwin,

What are you trying to do exactly?

I’ve use the MQTT Client successfully before and found it pretty simple. For example, my project needed to publish a JSON string, so to do this I just created a JSON structure and Export Mapping in Mendix. I then had a microflow map my data to a string using this mapping and called MQTT Publish to send the message in the Payload field. I had to set my Broker Host and Port to map to my Mosquitto broker, and set the Topic Name to the correct topic I wanted to publish to. I also set my Qos to At_Least_Once_1 and Timeout to 3000. All other values I set to “empty”. 

UPDATE:

If you want to listen to then I would suggest that you set up an After Startup event to that calls the MQTT Subscribe action. The setup is similar to the above, but add an “on message microflow to call when a message is received. This takes two String parameters Token and Payload. This will be called when an incoming message is received. You will also want to look at added a Before Shut Down microflow to call the MQTT Unsubscribe action. 

I hope this helps.

answered
0

Hello Robert,

I tried do as you said, But i am not able to connect to the broker. I am getting some error, i have attached the screenshots below,

 

 

 

Can you please help me in solving this error?

 

answered
0

Hi Melwin, I have completed this using MQTT protocol. Events need to be configure along with your device ID and json fmt.

answered