Skip to main content

EMQX MQTT Broker

⚠️ Deprecated since 1.14.0!!!!

VPC Peering

Role Assignment

EMQX: https://docs.emqx.com/en/cloud/latest/

IoT Data Engine is exposing the MQTT endpoint for IOT devices through the EMQX installation (3rd party partner). The integration between EMQX and IoT Data Engine is happening through VPC peering - Virtual Network peering.

EMQX VPC peering

To make the peering possible, the EMQX needs to have created a Service Principal in Proximus AAD, a custom role and role assigned to the IOTDE's Vnet to which the peering will happen. As we don't have privileges, those operations have to be executed by O365 OPS team, currently we're doing it with Maarten Faes.

To obtain the CLI commands needed, the UI of EMQX comes in handy. EMQX UI

Next the Vnet properties needs to be filled in and the UI will display needed commands (to be executed by O365 OPS). Peering commands

Once the set up is done, validate the connection and initiate peering.

Once it's finished successfully, you should be able to see peered EMQX virtual network. To check that go to virtual network of Data Engine -> Settings -> Peerings.

Map DNS to private IPs in the peering

Once peering is done, the last step is to ask EMQX team (via ticket) to map IP address of App Service private endpoint to its FQDN. Normally the backend service and MQTT protocol converter should have already created all configuration. That should be visible in Virtual Network -> Settings -> Connected devices. Same can be verified in the Private DNS zone deployed in the same resource group. Mapped private endpoints in Private DNS Zone

The FQDN is the URL that the App Service is normally available - value can be found on the App Service overview -> Default domain.

EMQX side configuration

Basic Config

In order to configure the data flow between EMQX and MQTT protocol converter, the following steps should be executed:

  1. Go to Data Integration.

  2. Create a new Connector of type HTTP Server: set URL as the FQDN of the application with https:// prefix

  3. Create a Rule:

    a. set simple SQL rule for incoming messages:

        SELECT
    payload as payload,
    clientid as clientId
    FROM
    <topic-name>

    b. choose Action: your connector name

Test

In order to test, a MQTT client app of choice should be used, for example MQTTX.

Little manual for MQTTX config:

  1. Connection should be created for MQTT protocol on port 1883.
  2. The username and password, should be set according to the MQTT device created in Data Engine and registered in IoT Hub.
  3. Once connected, you should set the name of the topic (same as topic name in Rule settings).
  4. Create a test message (JSON format).
  5. The messages should coming through and visible in logs of MQTT protocol converter.