-
-
Notifications
You must be signed in to change notification settings - Fork 33
Publish via output
Kees Schollaart edited this page Apr 14, 2018
·
7 revisions
- Add the
MqttAttribute
to one of your functions parameters - Use one of the constructor overloads to configure
- Usually it is sufficient to add one ore more topics to the attribute
- Make sure the type of the parameter is
IMqttMessage
and marked asout
[FunctionName("SimpleFunction")]
public static void SimpleFunction(
[TimerTrigger("0 */5 * * * *")]TimerInfo timer,
[Mqtt("testtopic/out")] out IMqttMessage outMessage)
{
outMessage = new MqttMessage("testtopic/in", new byte[] { }, MqttQualityOfServiceLevel.AtLeastOnce, true);
}
The connection to the MQTT broker is made when the first message is published and then reused/kept open for later messages.