OH3: Example for mqttpublish action in rule needed

I’m going crazy and didn’t find a working solution in the forum. All my attempts in the last few hours resulted in various errors.

Therefore I ask directly: Can someone please offer an example for a rule using mqttpublish in OH3?


I did it with
var mqttActions = Actions.getActions("mqtt","mqtt:broker:yourBrokerID"); mqttActions.publishMQTT("yourtopic", "hurray!")
Another solution, I found is:
actions.get("mqtt", "mqtt:broker:yourBrokerID").publishMQTT("yourtopic", "hurray!")