For the complete documentation index, see llms.txt. This page is also available as Markdown.

HiveMQ Integration

How to integrate HiveMQ with Connectware, including HiveMQ Cloud and self-hosted platform setup, bridging shop floor data from an ISA-95 topic hierarchy, and receiving commands in return.

This guide describes how to integrate HiveMQ with Connectware. You configure a service commissioning file that bridges selected shop floor data from the Connectware Unified Namespace (UNS) to a HiveMQ broker and receives commands from enterprise applications in return. The guide covers both HiveMQ Cloud and a self-hosted HiveMQ Platform. A complete example file is available at the end of this guide.

Objectives

  • Preparing a HiveMQ Cloud cluster or a self-hosted HiveMQ Platform broker for the connection.

  • Establishing a TLS-encrypted MQTT connection between Connectware and HiveMQ.

  • Bridging shop floor data from an ISA-95 topic hierarchy to HiveMQ topics.

  • Receiving commands from enterprise applications in Connectware.

Prerequisites

To follow this guide, you will need the following:

Connectware and HiveMQ Integration

HiveMQ is an enterprise MQTT platform, available as the managed HiveMQ Cloud service and as the self-hosted HiveMQ Platform. Connectware connects to it through the MQTT connector, like to any other MQTT broker.

In this integration, Connectware acts as the shop floor gateway: it connects the machines, normalizes their data into the UNS topic hierarchy, and governs who can access what. The HiveMQ broker is the enterprise messaging backbone that distributes data to IT consumers such as analytics platforms, dashboards, or other sites. The mappings in this guide bridge only selected topics of the UNS to HiveMQ, so the enterprise side sees curated data instead of raw machine traffic.

A few HiveMQ characteristics matter for this integration:

  • HiveMQ supports MQTT 3.1, 3.1.1, and 5.0 with all Quality of Service (QoS) levels, including QoS 2. The MQTT connector connects with MQTT 3.1.1 unless you set protocolVersion: 5 on the connection. The default works with HiveMQ without changes; set protocolVersion: 5 only if you want to use MQTT 5 features such as message expiry or user properties (see MQTT Connection Properties).

  • HiveMQ supports shared subscriptions ($share/<group>/<topic>) for both MQTT 3 and MQTT 5 clients, which lets multiple enterprise consumers split the load of the bridged telemetry among themselves.

  • HiveMQ Cloud only accepts TLS connections on port 8883, authenticated with the MQTT credentials that you create in the HiveMQ Cloud console.

  • If a second client connects with the same client ID, HiveMQ disconnects the first client. Choose a client ID that is unique on the broker.

The MQTT topics on the Connectware side follow an ISA-95-style equipment hierarchy (<enterprise>/<site>/<area>/<line>/<cell>). The mapping subscribes with wildcards across all levels, so any machine in the hierarchy is picked up without changing the integration. On the HiveMQ side, this guide uses the uns/ prefix for the bridged shop floor data and the cmd/ prefix for commands from enterprise applications.

Preparing HiveMQ Cloud

  1. Log in to the HiveMQ Cloud console and create a cluster, or select an existing one. The overview page of the cluster shows the cluster URL, which is the hostname for the connection.

  2. Open the Access Management tab of the cluster.

  3. In the Access Credentials area, create a credential for Connectware: define a username and a password, and assign the Publish and Subscribe permission.

The Serverless plan assigns one of the built-in permissions (Publish and Subscribe, Publish Only, or Subscribe Only) per credential. The Starter plan and above support custom roles and permissions with topic filters, which you can use to restrict the Connectware credential to the uns/# and cmd/# topic filters used in this guide. For more information, see HiveMQ Cloud Authentication and Authorization.

Preparing a Self-Hosted HiveMQ Platform

A self-hosted HiveMQ Platform accepts MQTT connections on the standard port 1883 by default, without TLS.

To accept TLS connections on port 8883, add a tls-tcp-listener with a keystore to the config.xml file of the broker (see HiveMQ Listeners). Create a username and password for Connectware in the security extension of your choice, with permissions to subscribe to the uns/# topic filter and to publish to the cmd/# topic filter.

HiveMQ Connection Parameters

The connection requires the hostname of the broker, the credentials created for Connectware, and a client ID. We add them as parameters to the service commissioning file, so you can set them when you install the service.

Do not worry about copying the service commissioning file snippets together into one, the complete example file is available at the end of this guide.

  • hivemqHost: The hostname of the HiveMQ broker. For HiveMQ Cloud, this is the cluster URL from the overview page of the cluster, for example a1b2c3d4e5f6.s1.eu.hivemq.cloud.

  • hivemqUsername and hivemqPassword: The MQTT credentials created for Connectware.

  • clientId: The MQTT client ID. HiveMQ disconnects an existing connection that uses the same client ID.

  • topicRoot: The root of the MQTT topic hierarchy on the Connectware side. Defaults to enterprise.

HiveMQ Connection

To connect to HiveMQ, we set up a Cybus::Connection resource that uses the MQTT connector with scheme: mqtts on port 8883, which matches HiveMQ Cloud and a self-hosted broker with a TLS listener.

The MQTT connector defaults to a keep-alive interval of 0, which disables client-side keep-alive pings. A value of 60 seconds lets both sides detect a broken connection even when no data flows.

If the certificate of a self-hosted broker is not signed by a public certificate authority (CA), provide the root CA certificate with the caCert property. To connect to a self-hosted broker without a TLS listener, set scheme: mqtt and port: 1883. For all available connection parameters, see MQTT Connection Properties.

Publishing Shop Floor Data to HiveMQ

A Cybus::Mapping resource bridges telemetry from the ISA-95 topic hierarchy to HiveMQ. The named wildcards +site, +area, +line, and +cell capture the levels of the source topic, and the publish side reuses them as $site, $area, $line, and $cell to mirror the hierarchy under the uns/ prefix.

A message published to enterprise/hamburg/assembly/line-1/press-01/telemetry now arrives on the HiveMQ topic uns/hamburg/assembly/line-1/press-01/telemetry. Any enterprise application that subscribes to uns/# receives the complete bridged hierarchy. The payload is forwarded unchanged. To reshape it before it reaches HiveMQ, for example to add a timestamp or flatten a structure, add rules to the mapping (see Rule Engine).

The mapping bridges only the telemetry leaf of the hierarchy. Machine-internal topics stay on the shop floor. To bridge additional data, add further mapping entries with their own topic filters instead of widening the wildcard, so the selection remains explicit.

Receiving Commands from HiveMQ

For the opposite direction, a Cybus::Endpoint resource subscribes to a command topic on the HiveMQ broker, and a mapping republishes every command to the Connectware topic hierarchy, where any other Connectware service can pick it up, for example to write a setpoint to a PLC.

Any enterprise application that is authorized to publish to cmd/shopfloor/commands on the HiveMQ broker can now send messages to the shop floor. Connectware republishes them to enterprise/backend/hivemq/commands.

Verifying the Integration

  1. Install the service and set the parameters with the values of your HiveMQ broker.

  2. Check that the connection is in the Connected state on the service details page in the Admin UI. If the credentials are wrong, the connection does not reach the connected state.

  3. Subscribe to the bridged topics on the HiveMQ side. On HiveMQ Cloud, open the Web Client tab of the cluster, connect with your credentials, and subscribe to uns/#. For a self-hosted broker, use the MQTT CLI tool that HiveMQ provides:

Replace ${HIVEMQ_HOST}, ${HIVEMQ_USERNAME}, and ${HIVEMQ_PASSWORD} with the hostname and the credentials of your broker. The -s flag enables TLS.

  1. Publish a test message to enterprise/hamburg/assembly/line-1/press-01/telemetry, for example with an MQTT client or the Admin UI. The message appears in the Web Client or the MQTT CLI subscription on uns/hamburg/assembly/line-1/press-01/telemetry.

  2. For the opposite direction, publish a test message to cmd/shopfloor/commands, either in the Send Message area of the Web Client or with the MQTT CLI:

  1. Use the Data Explorer to check that the message arrives on enterprise/backend/hivemq/commands.

Service Commissioning File Example

Last updated

Was this helpful?