question

Fiona Kattenstroth avatar image
2 Likes"
Fiona Kattenstroth asked Jeanette F commented

Problem with setting Callback node for MQTT connection

I have an issue with setting the callback node for my MQTT connection over FlexScript. First I set up the client like it's said in the user manual. That worked fine, I tested a couple of messages sent from the FlexSim model to my MQTT broker. Then I tried to receive a message from the broker using the client from the treenode with getMessage(). This also worked fine. Just the next step with setting up the default callback caused problems. I wanted it to listen to the broker and give me the topic and message whenever something is published on the broker, but I don't get any info. Maybe I messed it up during the configuration. This is how my callback node looks like (it's also linked in the client treenode).

2024-05-21-15h46-11.jpeg

Unfortunately I cannot upload the whole model.
It'd be really helpful, if you see my mistake or if someone can provide a model with a working callback node, so I can compare if mine is set up correctly. Thank you in advance.

FlexSim 24.1.0
flexscripttreenodemqtt
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·
Have you built the node as FlexScript? Did you remove the getMessage call? The syntax looks correct.
0 Likes 0 ·
Fiona Kattenstroth avatar image Fiona Kattenstroth Jason Lightfoot ♦♦ commented ·
I did both, but still don't get anything printed
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Fiona Kattenstroth commented ·

Here's an example you can use to cross reference. It has two scripts - one to publish to the broker and another to subscribe to the topic. To test it I would first publish (retaining the message) and then subscribe to check you can receive the message.

TestMosquittoEclipseProject.fsm

1 Like 1 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Fiona Kattenstroth,

We haven't heard back from you. Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·

0 Answers