HiveMQ Enterprise Extension for Google Cloud Pub/Sub
Pub/Sub is a fully-managed messaging service of the Google Cloud platform that allows you to send and receive messages between applications. Google Cloud Pub/Sub is typically used for streaming analytics and data integration pipelines to ingest and distribute data.
The HiveMQ Enterprise Extension for Google Cloud Pub/Sub enables you to seamlessly integrate MQTT device data with other Google Cloud services through the Google Cloud Pub/Sub service for further analysis, archiving, and more.
The flexible open-standards-based approach of the HiveMQ Enterprise Extension for Google Cloud Pub/Sub is a fast, reliable way to achieve bidirectional movement of MQTT messaging data between your HiveMQ broker and your Google Cloud services.
Features
-
Automatically convert MQTT user properties and Pub/Sub attributes to preserve data between the HiveMQ Broker and Google Cloud Pub/Sub.
-
Filter and transform MQTT and Pub/Sub messages bidirectionally at runtime with the HiveMQ customization SDK.
Requirements
-
A running HiveMQ Professional or Enterprise Edition installation, versions 4.9.0 and higher.
-
An active Google Cloud account.
-
For production use, a valid HiveMQ Enterprise Extension for Google Cloud Pub/Sub license.
If you do not provide a valid license, HiveMQ automatically uses a free trial license. Trial licenses for HiveMQ Enterprise Extensions are valid for 5 hours. For more license information or to request an extended evaluation license, contact HiveMQ sales. |
Installation
-
Place your HiveMQ Enterprise Extension for Google Cloud Pub/Sub license file (.elic) in the license folder of your HiveMQ installation. (Skip this step if you are using a trial version of the extension).
All HiveMQ Enterprise Extensions are preinstalled in your HiveMQ release bundle and disabled by default└─ <HiveMQ folder> ├── README.txt ├── audit ├── backup ├── bin ├── conf ├── data ├── extensions │ ├── hivemq-google-cloud-pubsub-extension │ │ ├── conf │ │ │ ├── config.xml (needs to be added by the user) │ │ │ ├── config.xsd │ │ │ └── examples │ │ │ └── ... │ │ ├── hivemq-google-cloud-pubsub-extension.jar │ │ ├── hivemq-extension.xml │ │ └── third-party-licenses │ │ └── ... ├── license ├── log ├── third-party-licenses └── tools
-
Before you enable the extension, you need to configure the extension to match your individual Google Cloud Pub/Sub topics and subscriptions.
For your convenience, we provide an example configurationconf/examples/config.xml
that you can copy and modify as desired.
The includedconfig.xsd
file outlines the schema and elements that can be used in the XML configuration.
Your completed configuration file must be namedconfig.xml
and located inHIVEMQ_HOME/extensions/hivemq-google-cloud-pubsub-extension/conf/config.xml
.
For detailed information on configuration options, see Configuration.Starting with HiveMQ 4.15.0, the configuration for the HiveMQ Extension for Google Cloud Pub/Sub is located in
HIVEMQ_HOME/extensions/hivemq-google-cloud-pubsub-extension/conf/config.xml
. Support for the previous locationHIVEMQ_HOME/extensions/hivemq-google-cloud-pubsub-extension/conf/hivemq-google-cloud-pubsub-extension.xml
will be removed in a future release.If applicable, move the configuration from
HIVEMQ_HOME/extensions/hivemq-google-cloud-pubsub-extension/conf/hivemq-google-cloud-pubsub-extension.xml
toHIVEMQ_HOME/extensions/hivemq-google-cloud-pubsub-extension/conf/config.xml
. -
To enable the HiveMQ Enterprise Extension for Google Cloud Pub/Sub, locate the
hivemq-google-cloud-pubsub-extension
folder in theextensions
directory of your HiveMQ installation and remove theDISABLED
file (if present).
To function properly, the HiveMQ Enterprise Extension for Google Cloud Pub/Sub must be installed on all HiveMQ broker nodes in your HiveMQ cluster and the configuration file on each node must be identical. |
Configuration
The HiveMQ Enterprise Extension for Google Cloud Pub/Sub supports hot reload of the extension configuration.
Changes that you make to the configuration of the extension are updated while the extension is running, without the need for a restart.
When the extension recognizes a valid configuration has been loaded, the previous configuration file is automatically archived in the config-archive
of the extension home folder.
If you load an invalid configuration at runtime and a previous valid configuration exists in the archive, HiveMQ uses the previous configuration. |
The extension configuration is divided into five sections:
-
Pub/Sub Connections: General connection and authentication information that is required to interact with Google Cloud.
-
MQTT-to-Pub/Sub Mappings: Routing information from one or more MQTT topic filters to one or more Google Cloud Pub/Sub topics.
-
PubSub-to-MQTT Mappings: Routing information from one or more Google Cloud Pub/Sub subscriptions to one or more MQTT topics.
-
MQTT to Google Cloud Pub/Sub Transformers: Programmatically specified customizations of message handling between HiveMQ and Google Cloud Pub/Sub.
-
Google Cloud Pub/Sub to MQTT Transformers: Programmatically specified customizations of topic subscription handling between Google Cloud Pub/Sub and HiveMQ.
Extension Configuration File
The config.xml
file is located in the hivemq-google-cloud-pubsub-extension/conf
folder within the extensions
folder of your HiveMQ installation.
The extension uses a simple but powerful XML-based configuration.
The HIVEMQ_HOME/extensions/hivemq-google-cloud-pubsub-extension/conf/examples/config.xml
file contains a basic configuration example that has all the parameters you need to set up bidirectional messaging of MQTT data between your HiveMQ Enterprise MQTT broker and Google Cloud Pub/Sub.
<?xml version="1.0" encoding="UTF-8" ?>
<hivemq-google-cloud-pubsub-extension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="config.xsd">
<!-- one or more connections to google-cloud pubsub -->
<pubsub-connections>
<pubsub-connection>
<id>your-custom-connection-id</id>
<google-cloud-project-id>my-google-cloud-project</google-cloud-project-id>
<authentication>
<service-account>
<file-path>/absolute/or/relative/path/to/service-account.json</file-path>
</service-account>
</authentication>
</pubsub-connection>
</pubsub-connections>
<mqtt-to-pubsub-mappings>
<mqtt-to-pubsub-mapping>
<id>mapping-01</id>
<pubsub-connection>your-custom-connection-id</pubsub-connection>
<mqtt-topic-filters>
<mqtt-topic-filter>topic/a</mqtt-topic-filter>
</mqtt-topic-filters>
<pubsub-topics>
<pubsub-topic>
<name>my-pubsub-topic</name>
</pubsub-topic>
</pubsub-topics>
</mqtt-to-pubsub-mapping>
</mqtt-to-pubsub-mappings>
<pubsub-to-mqtt-mappings>
<pubsub-to-mqtt-mapping>
<id>mapping-02</id>
<pubsub-connection>your-custom-connection-id</pubsub-connection>
<mqtt-topics>
<mqtt-topic>topic/b</mqtt-topic>
</mqtt-topics>
<pubsub-subscriptions>
<pubsub-subscription>
<name>my-pubsub-subscription</name>
</pubsub-subscription>
</pubsub-subscriptions>
</pubsub-to-mqtt-mapping>
</pubsub-to-mqtt-mappings>
</hivemq-google-cloud-pubsub-extension>
Pub/Sub Connections
The <pubsub-connections>
section of the extension configuration defines one or more connections to Google Cloud Pub/Sub.
You can define as many individual <pubsub-connection>
tags as your use case requires.
<!-- one or more connections to google-cloud pubsub -->
<pubsub-connections>
<pubsub-connection>
<id>your-custom-connection-id</id>
<google-cloud-project-id>my-google-cloud-project</google-cloud-project-id>
<authentication>
<service-account>
<file-path>/absolute/or/relative/path/to/service-account.json</file-path>
</service-account>
</authentication>
</pubsub-connection>
</pubsub-connections>
Configuration of Pub/Sub connections in your HiveMQ extension requires information from your Google Cloud (Google Cloud) account. Make sure that you have the necessary Google Cloud service information and permissions to complete the extension configuration. |
Google Cloud project identification and authentication
-
Google Cloud Project ID: To interact with Google Cloud resources, your HiveMQ extension must provide the correct project ID for every connection. From the console of your Google Cloud account, you can create a new project or connect to an existing Google Cloud project. Use the exact Google Cloud project ID name in your HiveMQ extension configuration.
-
Service Account: In addition to the correct Google Cloud project ID, your HiveMQ extension requires authentication information to interact with the Google Cloud Pub/Sub service. Generation of the necessary authentication key takes place in the IAM & Admin | Service Accounts area of your Google Cloud account. If you have not already done so, configure the Google Cloud service account you want to use to connect to your Google Cloud Pub/Sub topic. On the KEYS tab of the appropriate Google Cloud service account, add a Google Cloud service account key for use with your HiveMQ extension. Download the key as a JSON file. Save the file and note the file location path for use in your HiveMQ extension configuration.
-
Workload Identity Federation (WIF): Google Cloud also supports Workload Identity Federation to authenticate your HiveMQ extension against the Google Pub/Sub service. Workload Identity Federation enables applications that run outside of Google Cloud (such as your HiveMQ extension) to use short-lived access tokens. To use WIF, you configure Google Cloud to trust your external identity provider (IdP). Your HiveMQ extension uses the credentials your external IdP issues to impersonate your configured Google Pub/Sub service account. Google Cloud supports integration with OpenID Connect (OIDC) and SAML compliant IdPs as well as AWS. For more information, see Workload Identity Federation.
-
Generation of the necessary authentication file takes place in the IAM & Admin | Workload Identity Federation area of your Google Cloud account. Here, you can create a workload identity pool and add your provider. For more information, see Manage workload identity pools and providers. Make sure to grant access to the service account with the appropriate Google Cloud Pub/Sub permissions. On the CONNECTED SERVICE ACCOUNTS tab of your IAM & Admin | Workload Identity Federation area, download the Client Library Config as a JSON file. Save the file and note the file location path for use in your HiveMQ extension configuration.
-
<!-- one or more connections to google-cloud pubsub -->
<pubsub-connections>
<pubsub-connection>
<id>your-custom-connection-id</id>
<google-cloud-project-id>my-google-cloud-project</google-cloud-project-id>
<authentication>
<workload-identity>
<file-path>/absolute/or/relative/path/to/workload-identity.json</file-path>
</workload-identity>
</authentication>
</pubsub-connection>
</pubsub-connections>
The configured Google Cloud service account must include permission to do the following:
|
Parameter | Required | Type | Description |
---|---|---|---|
|
String |
The unique identifier of connection. This string can only contain alphanumeric characters, dashes, and underscores. |
|
|
String |
The identifier of the Google Cloud project in which the Pub/Sub service is located. This string must be an exact match to the project ID on your Google Cloud console. For more information, see Google Cloud Project ID and Service Account Key. |
|
|
Element |
The type of authentication that is configured for the extension.
|
MQTT to Google Cloud Pub/Sub Mapping
MQTT to Google Cloud Pub/Sub mapping defines which MQTT topics HiveMQ forwards to the configured Pub/Sub topics. The HiveMQ Enterprise Extension for Google Cloud Pub/Sub gives you the option to transfer MQTT-related metadata to the destination Google Cloud Pub/Sub topic as Google Cloud Pub/Sub attributes.
Use the <mqtt-to-pubsub-mappings>
section of your extension configuration to define one or more topic mappings of MQTT messages from HiveMQ to Google Cloud Pub/Sub.
You can define as many individual <mqtt-to-pubsub-mapping>
tags as your use case requires.
To configure your HiveMQ Google Cloud Pub/Sub extension, you need at least one Google Cloud PUB/Sub topic and an associated Pub/Sub subscription. To automatically create the topic subscription when you create your Pub/Sub topic in Google Cloud, make sure the Add a default subscription option is selected. On the Edit subscription tab for the Pub/Sub subscription, make sure Pull is selected in the Delivery Type settings. For detailed information on all Google Cloud Pub/Sub options, see Google Cloud Pub/Sub How-to. |
<mqtt-to-pubsub-mappings>
<mqtt-to-pubsub-mapping>
<id>mapping-01</id> <!-- REQUIRED -->
<pubsub-connection>your-custom-connection-id</pubsub-connection> <!-- REQUIRED -->
<preserve-message-properties>true</preserve-message-properties> <!-- OPTIONAL, Default = false -->
<mqtt-topic-filters> <!-- REQUIRED -->
<mqtt-topic-filter>topic/a</mqtt-topic-filter> <!-- REQUIRED, at least one -->
<mqtt-topic-filter>topic-filter/c</mqtt-topic-filter> <!-- OPTIONAL -->
<mqtt-topic-filter>topic-filter/d</mqtt-topic-filter> <!-- OPTIONAL -->
</mqtt-topic-filters>
<pubsub-topics> <!-- REQUIRED -->
<pubsub-topic> <!-- REQUIRED, at least one -->
<name>my-pubsub-topic</name> <!-- REQUIRED -->
<ordering-key> <!-- OPTIONAL -->
<mqtt-topic/>
</ordering-key>
</pubsub-topic>
</pubsub-topics>
<pubsub-attributes> <!-- OPTIONAL -->
<pubsub-attribute> <!-- OPTIONAL -->
<key>my-key-1</key> <!-- REQUIRED -->
<mqtt-topic/> <!-- REQUIRED -->
</pubsub-attribute> <!-- OPTIONAL -->
<pubsub-attribute> <!-- OPTIONAL -->
<key>my-key-2</key> <!-- REQUIRED -->
<value>my-value</value> <!-- REQUIRED -->
</pubsub-attribute> <!-- OPTIONAL -->
</pubsub-attributes>
</mqtt-to-pubsub-mapping>
</mqtt-to-pubsub-mappings>
Parameter | Required | Type | Description |
---|---|---|---|
|
String |
The unique identifier of MQTT to Pub/Sub mapping. This string can only contain alphanumeric characters, dashes, and underscores. |
|
|
Boolean |
Optional setting that defines whether the selected transformer is enabled or disabled. The default setting is |
|
|
String |
The |
|
|
Boolean |
Enables or disables the automatic conversion of MQTT user properties tO Google Cloud Pub/Sub attributes. The default setting is |
|
|
String |
A list of MQTT topic filters.
|
|
|
String |
A list of Google Cloud Pub/Sub topics.
|
|
|
String |
A list of Google Cloud Pub/Sub attributes.
|
If you configure static Google Cloud Pub/Sub attributes, the static attributes overwrite automatically-converted attributes that are created when the <preserve-message-attributes> option for the MQTT to Google Cloud Pub/Sub mapping is enabled.
|
Google Cloud Pub/Sub to MQTT Mapping
Pub/Sub to MQTT mapping represents the routing information of Pub/Sub messages from the configured Google Cloud Pub/Sub subscriptions to one or more MQTT topics on your HiveMQ broker.
The Google Cloud Pub/Sub extensions of the HiveMQ cluster nodes automatically work together as a group to pull messages from a Pub/Sub subscription.
Use the <pubsub-to-mqtt-mappings>
section of the extension configuration to define one or more mappings of MQTT messages from Google Cloud Pub/Sub to HiveMQ.
You can configure as many individual <pubsub-to-mqtt-mapping>
tags as your use case requires.
<pubsub-to-mqtt-mappings>
<pubsub-to-mqtt-mapping> <!-- REQUIRED -->
<id>mapping-02</id> <!-- REQUIRED -->
<pubsub-connection>your-custom-connection-id</pubsub-connection> <!-- REQUIRED -->
<mqtt-topics> <!-- REQUIRED -->
<mqtt-topic>topic/b</mqtt-topic> <!-- REQUIRED, at least one -->
</mqtt-topics>
<pubsub-subscriptions> <!-- REQUIRED -->
<pubsub-subscription> <!-- REQUIRED -->
<name>my-pubsub-topic-subscription</name> <!-- REQUIRED, at least one -->
</pubsub-subscription>
</pubsub-subscriptions>
</pubsub-to-mqtt-mapping>
</pubsub-to-mqtt-mappings>
Parameter | Required | Type | Description |
---|---|---|---|
|
String |
The unique identifier of Pub/Sub-to-MQTT mapping. This string can only contain alphanumeric characters, dashes, and underscores. |
|
|
Boolean |
Optional setting that defines whether the selected transformer is enabled or disabled. The default setting is |
|
|
String |
The |
|
|
Boolean |
Enables or disables the automatic conversion of Google Cloud Pub/Sub attributes to MQTT user properties. The default setting is |
|
|
String |
A list of MQTT destination topics.
|
|
|
String |
A list of the PubSub source subscriptions.
|
MQTT Publish Fields for Google Cloud Pub/Sub to MQTT Mapping
The HiveMQ Enterprise Extension for Google Cloud Pub/Sub gives you the option to set MQTT-related metadata and transfer Google Cloud Pub/Sub attributes to your HiveMQ broker as MQTT user properties.
Use <mqtt-publish-fields>
in your Google Cloud Pub/Sub to MQTT configuration to specify the metadata that outgoing MQTT publish messages in the Google Cloud Pub/Sub to MQTT mapping contain.
<pubsub-to-mqtt-mapping>
...
<mqtt-publish-fields> <!-- OPTIONAL -->
<retained-flag>true</retained-flag> <!-- OPTIONAL, Default = false -->
<payload-format-indicator>UTF8</payload-format-indicator> <!-- OPTIONAL, Default = absent -->
<message-expiry-interval>3600</message-expiry-interval> <!-- OPTIONAL, Default = absent -->
<response-topic>response/topic</response-topic> <!-- OPTIONAL, Default = absent -->
<correlation-data>correlation/data</correlation-data> <!-- OPTIONAL, Default = absent -->
<content-type>xml</content-type> <!-- OPTIONAL, Default = absent -->
<qos>2</qos> <!-- OPTIONAL, Default = 1 -->
<user-properties> <!-- OPTIONAL -->
<user-property> <!-- OPTIONAL -->
<name>prop1</name> <!-- REQUIRED -->
<value>val1</value> <!-- REQUIRED -->
</user-property>
</user-properties>
</mqtt-publish-fields>
</pubsub-to-mqtt-mapping>
Each MQTT publish field can contain only one variable. |
Parameter | Default | Type | Description |
---|---|---|---|
|
`false ` |
Boolean |
Defines whether all MQTT messages from the corresponding Google Cloud Pub/Sub mapping are retained. Possible values are |
|
Enum |
Sets the format of the payload of the corresponding Google Cloud Pub/Sub mapping. Possible values are UTF-8 or UNSPECIFIED. |
|
|
Integer |
Sets the lifetime in seconds of all MQTT messages from the corresponding Google Cloud Pub/Sub mapping. The message expiry timer starts at the moment that the MQTT message is published. The value must be positive. |
|
|
String |
Sets the response topic for all MQTT messages from the corresponding Google Cloud Pub/Sub mapping |
|
|
String |
Sets the data used to match response requests to the correct response messages for all MQTT messages from the corresponding Google Cloud Pub/Sub mapping. |
|
|
String |
Specifies the message payload content of all MQTT messages from the corresponding Google Cloud Pub/Sub mapping in a UTF-8 encoded string. |
|
|
|
Integer |
Sets the quality of service level (QoS) for all MQTT messages from the corresponding Google Cloud Pub/Sub mapping. Possible values are |
|
Adds one or more configurable user properties for all MQTT messages from the corresponding Google Cloud Pub/Sub mapping in |
Custom Transformers for the HiveMQ Enterprise Extension for Google Cloud Pub/Sub
The HiveMQ Google Cloud Pub/Sub Extension Customization SDK, provides a flexible API that gives you the ability to programmatically specify sophisticated custom handling of message transformations between HiveMQ and Google Cloud Pub/Sub.
The quickest way to learn about the new Customization SDK is to check out our Hello World Customization project on GitHub and use it as the basis for your own customization. |
HiveMQ transformers give you the possibility to decide at runtime where a published message is routed and which metadata to include.
To enable the use of a custom transformer, you extend the config.xml
file of your HiveMQ Enterprise Extension for Google Cloud Pub/Sub.
MQTT to Google Cloud Pub/Sub Transformers
<mqtt-to-pubsub-transformers>
<mqtt-to-pubsub-transformer>
<id>my-mqtt-to-pubsub-transformer-01</id>
<enabled>false</enabled>
<pubsub-connection>your-custom-connection-id</pubsub-connection>
<transformer>com.hivemq.extensions.google-cloud.pubsub.TestMqttToPubSubTransformer</transformer>
<mqtt-topic-filters>
<mqtt-topic-filter>mqtt/topic/a</mqtt-topic-filter>
<mqtt-topic-filter>mqtt/topic/+/a</mqtt-topic-filter>
<mqtt-topic-filter>mqtt/topic/c/#</mqtt-topic-filter>
</mqtt-topic-filters>
<custom-settings>
<custom-setting>
<name>destination</name>
<value>destination/pubsub/topic/a</value>
</custom-setting>
<custom-setting>
<name>destination</name>
<value>destination/pubsub/topic/b</value>
</custom-setting>
<custom-setting>
<name>filepath</name>
<value>path-to-file</value>
</custom-setting>
</custom-settings>
</mqtt-to-pubsub-transformer>
</mqtt-to-pubsub-transformers>
Parameter | Required | Type | Description |
---|---|---|---|
|
String |
The unique identifier of the transformer. |
|
|
Boolean |
Optional setting that defines whether the selected transformer is enabled or disabled. The default setting is |
|
|
String |
The |
|
|
String |
A list of MQTT topic filters.
|
|
|
String |
The canonical class name of the transformer that is used. |
|
|
Element |
A list of the custom settings that are available in the init input method of the transformer.
|
Google Cloud Pub/Sub to MQTT Transformers
<pubsub-to-mqtt-transformers>
<pubsub-to-mqtt-transformer>
<id>my-pubsub-to-mqtt-transformer-01</id>
<enabled>true</enabled>
<pubsub-connection>your-custom-connection-id</pubsub-connection>
<pubsub-subscriptions>
<pubsub-subscription>
<name>sub-for-a</name> <!-- REQUIRED -->
</pubsub-subscription>
<pubsub-subscription>
<name>sub-for-b</name> <!-- REQUIRED -->
</pubsub-subscription>
</pubsub-subscriptions>
<transformer>com.hivemq.extensions.google-cloud.pubsub.TestPubSubToMqttTransformer</transformer>
<custom-settings>
<custom-setting>
<name>destination</name>
<value>destination/mqtt/topic/a</value>
</custom-setting>
<custom-setting>
<name>destination</name>
<value>destination/mqtt/topic/b</value>
</custom-setting>
<custom-setting>
<name>filepath</name>
<value>path-to-file</value>
</custom-setting>
</custom-settings>
</pubsub-to-mqtt-transformer>
</pubsub-to-mqtt-transformers>
Parameter | Required | Type | Description |
---|---|---|---|
|
String |
The unique identifier of the transformer. |
|
|
Boolean |
Optional setting that defines whether the selected transformer is enabled or disabled. The default setting is |
|
|
String |
The |
|
|
String |
A list of the Google Cloud Pub/Sub source subscriptions.
|
|
|
String |
The canonical class name of the transformer that is used. |
|
|
Element |
A list of the custom settings that are available in the init input method of the transformer.
|
<hivemq-google-cloud-pubsub-extension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="config.xsd">
<pubsub-connections>
<pubsub-connection>
<id>connection-01</id>
<google-cloud-project-id>my-test-project</google-cloud-project-id>
<authentication>
<service-account>
<file-path>/absolute/or/relative/path/to/service-account.json</file-path>
</service-account>
</authentication>
</pubsub-connection>
<pubsub-connection>
<id>connection-02</id>
<google-cloud-project-id>my-other-project</google-cloud-project-id>
<authentication>
<workload-identity>
<file-path>/absolute/or/relative/path/to/client-config.json</file-path>
</workload-identity>
</authentication>
</pubsub-connection>
</pubsub-connections>
<pubsub-to-mqtt-mappings>
<pubsub-to-mqtt-mapping>
<id>pubsub-to-mqtt-mapping-1</id>
<enabled>true</enabled>
<pubsub-connection>connection-02</pubsub-connection>
<preserve-message-properties>true</preserve-message-properties>
<mqtt-topics>
<mqtt-topic>topic/1</mqtt-topic>
<mqtt-topic>topic/2</mqtt-topic>
<mqtt-topic>topic/3</mqtt-topic>
</mqtt-topics>
<pubsub-subscriptions>
<pubsub-subscription>
<name>sub-for-a</name>
</pubsub-subscription>
</pubsub-subscriptions>
<mqtt-publish-fields>
<retained-flag>true</retained-flag>
<payload-format-indicator>UTF_8</payload-format-indicator>
<message-expiry-interval>3600</message-expiry-interval>
<response-topic>response/topic</response-topic>
<correlation-data>correlation/data</correlation-data>
<content-type>xml</content-type>
<qos>2</qos>
<user-properties>
<user-property>
<name>prop1</name>
<value>val1</value>
</user-property>
</user-properties>
</mqtt-publish-fields>
</pubsub-to-mqtt-mapping>
</pubsub-to-mqtt-mappings>
<mqtt-to-pubsub-mappings>
<mqtt-to-pubsub-mapping>
<id>mqtt-to-pubsub-mapping-1</id>
<enabled>true</enabled>
<pubsub-connection>connection-02</pubsub-connection>
<preserve-message-properties>true</preserve-message-properties>
<mqtt-topic-filters>
<mqtt-topic-filter>topic/#</mqtt-topic-filter>
<mqtt-topic-filter>topic/+/2</mqtt-topic-filter>
<mqtt-topic-filter>topic/3</mqtt-topic-filter>
</mqtt-topic-filters>
<pubsub-topics>
<pubsub-topic>
<name>my-pubsub-topic</name>
<ordering-key>
<mqtt-topic/>
</ordering-key>
</pubsub-topic>
<pubsub-topic>
<ordering-key>
<mqtt-topic/>
</ordering-key>
</pubsub-topic>
</pubsub-topics>
<pubsub-attributes>
<pubsub-attribute>
<value>val1</value>
<key>key1</key>
</pubsub-attribute>
</pubsub-attributes>
</mqtt-to-pubsub-mapping>
</mqtt-to-pubsub-mappings>
<pubsub-to-mqtt-transformers>
<pubsub-to-mqtt-transformer>
<id>my-pubsub-to-mqtt-transformer-01</id>
<enabled>true</enabled>
<pubsub-connection>connection-02</pubsub-connection>
<transformer>com.hivemq.extensions.google-cloud.pubsub.TestPubSubToMqttTransformer</transformer>
<pubsub-subscriptions>
<pubsub-subscription>
<name>sub-for-a</name>
</pubsub-subscription>
<pubsub-subscription>
<name>sub-for-b</name>
</pubsub-subscription>
</pubsub-subscriptions>
<custom-settings>
<custom-setting>
<name>destination</name>
<value>destination/mqtt/topic/a</value>
</custom-setting>
<custom-setting>
<name>destination</name>
<value>destination/mqtt/topic/b</value>
</custom-setting>
<custom-setting>
<name>filepath</name>
<value>path-to-file</value>
</custom-setting>
</custom-settings>
</pubsub-to-mqtt-transformer>
</pubsub-to-mqtt-transformers>
<mqtt-to-pubsub-transformers>
<mqtt-to-pubsub-transformer>
<id>my-mqtt-to-pubsub-transformer-01</id>
<enabled>false</enabled>
<pubsub-connection>connection-02</pubsub-connection>
<mqtt-topic-filters>
<mqtt-topic-filter>mqtt/topic/a</mqtt-topic-filter>
<mqtt-topic-filter>mqtt/topic/+/a</mqtt-topic-filter>
<mqtt-topic-filter>mqtt/topic/c/#</mqtt-topic-filter>
</mqtt-topic-filters>
<transformer>com.hivemq.extensions.google-cloud.pubsub.TestMqttToPubSubTransformer</transformer>
<custom-settings>
<custom-setting>
<name>destination</name>
<value>destination/pubsub/topic/a</value>
</custom-setting>
<custom-setting>
<name>destination</name>
<value>destination/pubsub/topic/b</value>
</custom-setting>
<custom-setting>
<name>filepath</name>
<value>path-to-file</value>
</custom-setting>
</custom-settings>
</mqtt-to-pubsub-transformer>
<mqtt-to-pubsub-transformer>
<id>my-mqtt-to-pubsub-transformer-02</id>
<enabled>true</enabled>
<pubsub-connection>connection-02</pubsub-connection>
<mqtt-topic-filters>
<mqtt-topic-filter>mqtt/topic/a</mqtt-topic-filter>
<mqtt-topic-filter>mqtt/topic/+/a</mqtt-topic-filter>
<mqtt-topic-filter>mqtt/topic/c/#</mqtt-topic-filter>
</mqtt-topic-filters>
<transformer>com.hivemq.extensions.google-cloud.pubsub.TestMqttToPubSubTransformer</transformer>
<custom-settings>
<custom-setting>
<name>destination</name>
<value>destination/pubsub/topic/a</value>
</custom-setting>
<custom-setting>
<name>destination</name>
<value>destination/pubsub/topic/b</value>
</custom-setting>
<custom-setting>
<name>filepath</name>
<value>path-to-file</value>
</custom-setting>
</custom-settings>
</mqtt-to-pubsub-transformer>
</mqtt-to-pubsub-transformers>
</hivemq-google-cloud-pubsub-extension>
Metrics
The HiveMQ Enterprise Extension for Google Cloud Pub/Sub provides several metrics that can be monitored to observe how the extension behaves over time.
All HiveMQ Enterprise Extension for Google Cloud Pub/Sub metrics start with the prefix com.hivemq.extensions.google-cloud-pubsub.
The following table lists each metric the extension exposes.
For increased readability, the com.hivemq.extensions.google-cloud-pubsub.
prefix is omitted in the tables.
For more information on HiveMQ metrics, see metric types.
Name | Type | Description |
---|---|---|
mqtt-to-pubsub.consumer.count.current |
|
The current number of MQTT to Google Cloud Pub/Sub consumers. |
mqtt-to-pubsub.in-progress.count.current |
|
The current number of MQTT to Google Cloud Pub/Sub messages that MQTT to Google Cloud Pub/Sub consumers process. |
mqtt-to-pubsub.projects.[project_id].failed.count |
|
The number of MQTT to Google Cloud Pub/Sub messages project |
mqtt-to-pubsub.projects.[project_id].success.count |
|
The number of MQTT to Google Cloud Pub/Sub messages project |
mqtt-to-pubsub.total.dropped.count |
|
The total number of messages the extension drops from MQTT to Google Cloud Pub/Sub. |
mqtt-to-pubsub.total.failed.count |
|
The total number of MQTT to Google Cloud Pub/Sub messages the extension cannot successfully forward. |
mqtt-to-pubsub.total.ignored.count |
|
The total number of MQTT to Google Cloud Pub/Sub messages the extension ignores. |
mqtt-to-pubsub.total.resent.count |
|
The total number of MQTT to Google Cloud Pub/Sub messages the extension resends. |
mqtt-to-pubsub.total.sent.count |
|
The total number of MQTT to Google Cloud Pub/Sub messages the extension sends. |
mqtt-to-pubsub.total.success.count |
|
The total number of MQTT to Google Cloud Pub/Sub messages from all transformers and mappings that the extension successfully forwards. |
mqtt-to-pubsub.mapping.[mapping_id].failed.count |
|
The number of MQTT to Google Cloud Pub/Sub messages mapping |
mqtt-to-pubsub.mapping.[mapping_id].ignored.count |
|
The number of MQTT to Google Cloud Pub/Sub messages mapping |
mqtt-to-pubsub.mapping.[mapping_id].latency |
|
The amount of time mapping |
mqtt-to-pubsub.mapping.[mapping_id].resent.count |
|
The number of MQTT to Google Cloud Pub/Sub messages mapping |
mqtt-to-pubsub.mapping.[mapping_id].sent.count |
|
The number of MQTT to Google Cloud Pub/Sub messages mapping |
mqtt-to-pubsub.mapping.[mapping_id].success.count |
|
The number of MQTT to Google Cloud Pub/Sub messages mapping |
mqtt-to-pubsub.mapping.count.current |
|
The current number of MQTT to Google Cloud Pub/Sub mappings. |
mqtt-to-pubsub.total.attributes.overwritten.count |
|
The total number of MQTT user properties in MQTT to Google Cloud Pub/Sub messages the extension overwrites. |
mqtt-to-pubsub.total.user-properties.dropped.count |
|
The total number of MQTT user properties in MQTT to Google Cloud Pub/Sub messages the extension drops. |
mqtt-to-pubsub.total.user-properties.duplicates.count |
|
The total number of MQTT user properties in MQTT to Google Cloud Pub/Sub messages the extension duplicates. |
pubsub-to-mqtt.subscriber.count.current |
|
The current number of Google Cloud Pub/Sub to MQTT subscribers. |
pubsub-to-mqtt.projects.[project_id].failed.count |
|
The number of Google Cloud Pub/Sub to MQTT messages project |
pubsub-to-mqtt.projects.[project_id].success.count |
|
The number of Google Cloud Pub/Sub to MQTT messages project |
pubsub-to-mqtt.total.dropped.count |
|
The total number of messages the extension drops from Google Cloud Pub/Sub to MQTT. |
pubsub-to-mqtt.total.failed.count |
|
The total number of Google Cloud Pub/Sub to MQTT messages the extension cannot forward successfully. |
pubsub-to-mqtt.total.ignored.count |
|
The total number of Google Cloud Pub/Sub to MQTT messages the extension ignores. |
pubsub-to-mqtt.total.pubsub-attributes.dropped.count |
|
The total number of Pub/Sub attributes in Google Cloud Pub/Sub to MQTT messages the extension drops. |
pubsub-to-mqtt.total.rate-limit-exceeded.count |
|
The total number of Google Cloud Pub/Sub to MQTT messages that exceed the configured rate-limit. |
pubsub-to-mqtt.total.received.count |
|
The total number of Google Cloud Pub/Sub to MQTT messages the extension receives. |
pubsub-to-mqtt.total.sent.count |
|
The total number of Google Cloud Pub/Sub to MQTT messages the extension sends. |
pubsub-to-mqtt.total.success.count |
|
The total number of Google Cloud Pub/Sub to MQTT messages the extension successfully processes. |
pubsub-to-mqtt.mapping.[mapping_id].dropped.count |
|
The number of Google Cloud Pub/Sub to MQTT messages mapping |
pubsub-to-mqtt.mapping.[mapping_id].failed.count |
|
The number of Google Cloud Pub/Sub to MQTT messages mapping |
pubsub-to-mqtt.mapping.[mapping_id].latency |
|
The length of time mapping |
pubsub-to-mqtt.mapping.[mapping_id].ignored.count |
|
The number of Google Cloud Pub/Sub to MQTT messages mapping |
pubsub-to-mqtt.mapping.[mapping_id].rate-limit-exceeded.count |
|
The number of Google Cloud Pub/Sub to MQTT messages that exceed the configured rate-limit for mapping |
pubsub-to-mqtt.mapping.[mapping_id].received.count |
|
The number of Google Cloud Pub/Sub to MQTT messages mapping |
pubsub-to-mqtt.mapping.[mapping_id].sent.count |
|
The number of Google Cloud Pub/Sub to MQTT messages mapping |
pubsub-to-mqtt.mapping.[mapping_id].success.count |
|
The number of Google Cloud Pub/Sub to MQTT messages mapping |
pubsub-to-mqtt.mapping.count.current |
|
The current number of Google Cloud Pub/Sub to MQTT mappings. |
Google Cloud Pub/Sub Extension Customization SDK Metrics
The following metrics are available when you implement an MQTT to Google Cloud Pub/Sub or Google Cloud Pub/Sub to MQTT transformer with the HiveMQ Google Cloud Pub/Sub Extension Customization SDK:
Name | Type | Description |
---|---|---|
mqtt-to-pubsub.transformer.[transformer_id].success.count |
|
The number of MQTT to Google Cloud Pub/Sub messages transformer |
mqtt-to-pubsub.transformer.[transformer_id].failed.count |
|
The number of MQTT to Google Cloud Pub/Sub messages transformer |
mqtt-to-pubsub.transformer.[transformer_id].ignored.count |
|
The number of MQTT to Google Cloud Pub/Sub messages transformer |
mqtt-to-pubsub.transformer.[transformer_id].resent.count |
|
The number of MQTT to Google Cloud Pub/Sub messages transformer |
mqtt-to-pubsub.transformer.[transformer_id].sent.count |
|
The number of MQTT to Google Cloud Pub/Sub messages transformer |
mqtt-to-pubsub.transformer.[transformer_id].latency |
|
The amount of time transformer |
mqtt-to-pubsub.transformer.count.current |
|
The current number of MQTT to Google Cloud Pub/Sub transformers. |
pubsub-to-mqtt.transformer.[transformer_id].success.count |
|
The number of Google Cloud Pub/Sub to MQTT messages transformer |
pubsub-to-mqtt.transformer.[transformer_id].failed.count |
|
The number of Google Cloud Pub/Sub to MQTT messages transformer |
pubsub-to-mqtt.transformer.[transformer_id].dropped.count |
|
The number of Google Cloud Pub/Sub to MQTT messages transformer |
pubsub-to-mqtt.transformer.[transformer_id].ignored.count |
|
The number Google Cloud Pub/Sub to MQTT messages transformer |
pubsub-to-mqtt.transformer.[transformer_id].rate-limit-exceeded.count |
|
The number of Google Cloud Pub/Sub to MQTT messages that exceeded the configured rate-limit for transformer |
pubsub-to-mqtt.transformer.[transformer_id].received.count |
|
The number of Google Cloud Pub/Sub messages transformer |
pubsub-to-mqtt.transformer.[transformer_id].sent.count |
|
The number of Google Cloud Pub/Sub to MQTT messages transformer |
pubsub-to-mqtt.transformer.[transformer_id].latency |
|
The length of time transformer |
pubsub-to-mqtt.transformer.count.current |
|
The current number of Google Cloud Pub/Sub to MQTT transformers. |