sparkplug_b input
Sparkplug B MQTT input with idiomatic configuration
- Common
- Advanced
# Common config fields, showing default values
input:
label: ""
sparkplug_b:
mqtt:
urls: ["tcp://localhost:1883"]
client_id: "benthos-sparkplug-input"
credentials:
username: ""
password: ""
qos: 1
keep_alive: "60s"
connect_timeout: "30s"
clean_session: true
identity:
group_id: "" # No default (required)
edge_node_id: "" # No default (optional)
device_id: ""
role: "secondary_passive"
request_birth_on_connect: true
birth_request_throttle: "1s"
subscription:
groups: []
# All config fields, showing default values
input:
label: ""
sparkplug_b:
mqtt:
urls: ["tcp://localhost:1883"]
client_id: "benthos-sparkplug-input"
credentials:
username: ""
password: ""
qos: 1
keep_alive: "60s"
connect_timeout: "30s"
clean_session: true
identity:
group_id: "" # No default (required)
edge_node_id: "" # No default (optional)
device_id: ""
role: "secondary_passive"
request_birth_on_connect: true
birth_request_throttle: "1s"
include_edge_node_in_location: false
decode_extensions:
extensions: ""
subscription:
groups: []
A Sparkplug B input plugin with three Host roles:
SPARKPLUG B HOST ROLES:
- secondary_passive (default): Read-only consumer, no rebirth commands, safe for brownfield
- secondary_active: Active consumer, sends rebirth commands, no STATE publishing
- primary: Full Primary Host with STATE publishing and session management
Key features:
- Three-role system for different deployment scenarios
- Safe default role prevents rebirth storms
- Automatic STATE topic management with LWT (Primary role only)
- Sequence number validation and rebirth coordination
- Alias resolution using BIRTH message metadata
- Configurable message processing (splitting, extraction, filtering)
- Comprehensive metrics and monitoring
Fields
mqtt
MQTT transport configuration
Type: object
mqtt.urls
List of MQTT broker URLs to connect to
Type: array of string
Default: ["tcp://localhost:1883"]
mqtt.client_id
MQTT client ID for this input plugin
Type: string
Default: "benthos-sparkplug-input"
mqtt.credentials
MQTT authentication credentials
Type: object
mqtt.credentials.username
MQTT username for authentication
Type: string
Default: ""
mqtt.credentials.password
MQTT password for authentication
This field contains sensitive information. Use a secret reference rather than a literal value.
Type: string
Default: ""
mqtt.qos
QoS level for MQTT operations (0, 1, or 2)
Type: int
Default: 1
mqtt.keep_alive
MQTT keep alive interval
Type: string
Default: "60s"
mqtt.connect_timeout
MQTT connection timeout
Type: string
Default: "30s"
mqtt.clean_session
MQTT clean session flag
Type: bool
Default: true
identity
Sparkplug identity configuration
Type: object
identity.group_id
Sparkplug Group ID (e.g., 'FactoryA'). Serves two purposes: it is the publishing identity, and it is the default subscription filter (subscribes to spBv1.0/<group_id>/#). Set subscription.groups to override the filter.
Type: string
identity.edge_node_id
For the 'primary' role this field is required and is used as the Sparkplug v3.0 host_id in the STATE topic (spBv1.0/STATE/<host_id>). For the 'secondary_passive' and 'secondary_active' roles it is optional and used only for identification.
Type: string
identity.device_id
Device ID under the edge node (optional, if not specified acts as node-level)
Type: string
Default: ""
role
Sparkplug Host role: 'secondary_passive' (default), 'secondary_active', or 'primary'
Type: string
Default: "secondary_passive"
request_birth_on_connect
Send REBIRTH when DATA arrives from a node with no prior BIRTH on this bridge. Typical after a bridge restart with no retained NBIRTH/DBIRTH on the broker. Ignored under secondary_passive. Controls only the discovery path; sequence-gap and unresolved-aliases recovery always run.
Type: bool
Default: true
birth_request_throttle
Minimum time between REBIRTH commands to the same node, applied across every rebirth reason. Prevents the alias-recovery storm where DATA arriving in the BIRTH round-trip window fires another rebirth. Set to 0 to disable throttling.
Type: string
Default: "1s"
include_edge_node_in_location
Nest device-level data under its Sparkplug edge node, so location_path becomes <edge_node>.<device> (e.g. 'Line1.IO_Controller'). Enable for native/brownfield Sparkplug where the edge node is a real hierarchy level and devices on different nodes may share a name. Leave disabled (default) for UMH Parris-encoded publishers where device_id already carries the full location path. Node-level data (no device) is unaffected.
Type: bool
Default: false
decode_extensions
Opt-in decoding of proto2 Sparkplug extension fields that the standard decode retains but ignores.
Type: object
decode_extensions.extensions
Inline proto2 schema declaring extensions of the Sparkplug Payload.MetaData and/or Payload.MetricValueExtension messages. Write only package + extend blocks, plus any custom message types or well-known-type imports; the plugin compiles it as proto2 and adds the Sparkplug import (do not write a syntax line or import the Sparkplug schema). Scalar extensions are attached per carrying metric as spb_ext_<field>; the full decoded metric (including message-typed extensions) as spb_metric_decoded JSON. Metrics without an extension are unaffected.
Type: string
Default: ""
subscription
Subscription filtering configuration. Defaults to filtering by identity.group_id. Set subscription.groups to listen to multiple groups or to ["+"] to subscribe to every group.
Type: object
subscription.groups
Groups to subscribe to. When empty (the default), the plugin filters to identity.group_id. Set multiple group IDs to listen to several groups, or ["+"] to subscribe to every group via the MQTT wildcard.
Type: array of string
Default: []