Event Hub Publisher Block Config

The Event Hub Publisher block can be instantiated by using the block type eventhub.

See The Blocks Section for an explanation of what a block is in the Cloud Gateway.
Note: The Event Hub block's configuration has changed significantly from its earlier iterations.
The configuration fields (in the config portion of the block configuration) for the eventhub block are as follows:
Table 1. Configuration Fields
FieldTypeRequiredDefault
log_nameStringno<block name>
log_levelStringno'off'
mqtt/transport_addrStringyes
mqtt/qosIntegerno0
mqtt/client_idStringno
mqtt/topicsArray of Stringsyes
store_forwardObjectyes
store_forward/max_store_percentIntegerno10
store_forward/max_batch_intervalIntegerno1000
eventhub/transport_addrStringyes
eventhub/predix_zone_idStringyes
eventhub/token_fileStringyes
eventhub/topic_mapArray of Objectsyes

The following is a sample block config for the eventhub block. This should be placed in the blocks section of the overall configuration file.

The block below is configured to subscribe to the MQTT topic input_data on the Predix Edge Broker and publish all data received from that topic to the Event Hub topic output_data on a Predix Time Series instance with the Predix Zone ID xxx-xxx at the URL event-hub-aws-usw02.data-services.predix.io:443.

The block's name in this example is event_hub_sender, but it can be any string you wish to use.
"event_hub_sender": {
    "type": "eventhub",
    "config": {
        "log_name": "eventhub_block",
        "log_level": "debug",
        "mqtt": {
            "transport_addr": "mqtt-tcp://predix-edge-broker",
            "qos": 1,
            "client_id": "event_hub_mqtt_client0",
            "topics": [
                "input_data"
            ]
        },
        "store_forward": {
            "max_store_percent": 30,
            "max_batch_interval": 2000
        },
        "eventhub": {
            "transport_addr": "event-hub-aws-usw02.data-services.predix.io:443",
            "predix_zone_id": "xxx-xxx",
            "token_file": "/edge-agent/access_token",
            "topic_map": [
                {
                    "eventhub_topic": "output_data",
                    "mqtt_topics": [
                        "input_data"
                    ]
                }
            ]
        }
    }
}

log_level and log_name

For details on the log_level and log_name fields of the Event Hub Publisher block's config section, see Common Block Config Fields.

mqtt

For details on fields within the mqtt portion of the Event Hub Publisher block's config section, see Common Block Config Fields.

store_forward/max_store_percent and store_forward/max_batch_interval

For details on the store_forward/max_store_percent and store_forward/max_batch_interval fields of the Event Hub Publisher block's config section, see Common Block Config Fields.

eventhub/transport_addr

The transport_addr field within the eventhub section should be set to the URI of whatever Predix Event Hub instance you wish to publish data to.

eventhub/predix_zone_id

The predix_zone_id field within the eventhub section should be set to the Predix Zone ID of whatever Predix Event Hub instance you wish to publish data to.

eventhub/token_file

The token_file field within the eventhub section should be set to the path to the file on your Predix Edge device that holds your UAA token for authentication with your Predix Event Hub instance.

eventhub/topic_map

The proxy_url field within the eventhub section specifies how data will be forwarded from input MQTT topics to output Event Hub topics. This section is an array of objects with the following fields:
FieldTypeRequired
eventhub_topicStringyes
mqtt_topicsArray of Stringsyes
Data received from subscriptions to the topics in the mqtt_topics field of one object will be published to the Event Hub topic in the eventhub_topic field of that same object.
Note: If an MQTT topic is not specified anywhere in the topic map, it will NOT be subscribed to even if it is in the topics list in the mqtt section of the block's config section.
Note: The Event Hub block does not currently support forwarding data from one MQTT topic to multiple Predix Event Hub topics.