Skip to main content

MQTT Writer

Writes messages to an MQTT broker.

See the MQTT FAQ for information on firewall settings.

MQTT Writer properties

property

type

default value

notes

Broker URI

String

format is tcp://<broker address>:<broker port>

Client ID

String

MQTT client ID (maximum 23 characters). Must be unique (not used by any other client) in order to identify this instance of MQTTWriter. The MQTT broker will use this ID close the connection when MQTTWriter goes offline and resend events after it restarts.

QoS

Integer

0

  • 0: at most once

  • 1: at least once

  • 2: exactly once

Topic

String

This adapter has a choice of formatters. See Supported writer-formatter combinations for more information.Supported writer-formatter combinations

MQTT Writer sample application

CREATE CQ ConvertTemperatureToControl
INSERT INTO controlstream
SELECT TO_STRING(data.get('roomName') ),
  TO_STRING(data.get('temperature'))
FROM tempstream;
CREATE TARGET accontrol USING MQTTWriter(
  brokerUri:'tcp://m2m.eclipse.org:1883',
  Topic:'/striim/room687/accontrol',
  QoS:0,
  clientId:"StriimMqttSource"
) 
FORMAT USING JSONFormatter (
    members:'roomName,targetTemperature'
) 
INPUT FROM controlstream;