github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/inputs/mqtt.md (about)

     1  ---
     2  title: mqtt
     3  type: input
     4  status: stable
     5  categories: ["Services"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/input/mqtt.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  
    19  Subscribe to topics on MQTT brokers.
    20  
    21  
    22  <Tabs defaultValue="common" values={[
    23    { label: 'Common', value: 'common', },
    24    { label: 'Advanced', value: 'advanced', },
    25  ]}>
    26  
    27  <TabItem value="common">
    28  
    29  ```yaml
    30  # Common config fields, showing default values
    31  input:
    32    label: ""
    33    mqtt:
    34      urls:
    35        - tcp://localhost:1883
    36      topics:
    37        - benthos_topic
    38      client_id: benthos_input
    39      connect_timeout: 30s
    40  ```
    41  
    42  </TabItem>
    43  <TabItem value="advanced">
    44  
    45  ```yaml
    46  # All config fields, showing default values
    47  input:
    48    label: ""
    49    mqtt:
    50      urls:
    51        - tcp://localhost:1883
    52      topics:
    53        - benthos_topic
    54      client_id: benthos_input
    55      dynamic_client_id_suffix: ""
    56      qos: 1
    57      clean_session: true
    58      will:
    59        enabled: false
    60        qos: 0
    61        retained: false
    62        topic: ""
    63        payload: ""
    64      connect_timeout: 30s
    65      user: ""
    66      password: ""
    67      keepalive: 30
    68      tls:
    69        enabled: false
    70        skip_cert_verify: false
    71        enable_renegotiation: false
    72        root_cas: ""
    73        root_cas_file: ""
    74        client_certs: []
    75  ```
    76  
    77  </TabItem>
    78  </Tabs>
    79  
    80  ### Metadata
    81  
    82  This input adds the following metadata fields to each message:
    83  
    84  ``` text
    85  - mqtt_duplicate
    86  - mqtt_qos
    87  - mqtt_retained
    88  - mqtt_topic
    89  - mqtt_message_id
    90  ```
    91  
    92  You can access these metadata fields using
    93  [function interpolation](/docs/configuration/interpolation#metadata).
    94  
    95  ## Fields
    96  
    97  ### `urls`
    98  
    99  A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.
   100  
   101  
   102  Type: `array`  
   103  Default: `["tcp://localhost:1883"]`  
   104  
   105  ### `topics`
   106  
   107  A list of topics to consume from.
   108  
   109  
   110  Type: `array`  
   111  Default: `["benthos_topic"]`  
   112  
   113  ### `client_id`
   114  
   115  An identifier for the client connection.
   116  
   117  
   118  Type: `string`  
   119  Default: `"benthos_input"`  
   120  
   121  ### `dynamic_client_id_suffix`
   122  
   123  Append a dynamically generated suffix to the specified `client_id` on each run of the pipeline. This can be useful when clustering Benthos producers.
   124  
   125  
   126  Type: `string`  
   127  Default: `""`  
   128  
   129  | Option | Summary |
   130  |---|---|
   131  | `nanoid` | append a nanoid of length 21 characters |
   132  
   133  
   134  ### `qos`
   135  
   136  The level of delivery guarantee to enforce.
   137  
   138  
   139  Type: `int`  
   140  Default: `1`  
   141  Options: `0`, `1`, `2`.
   142  
   143  ### `clean_session`
   144  
   145  Set whether the connection is non-persistent.
   146  
   147  
   148  Type: `bool`  
   149  Default: `true`  
   150  
   151  ### `will`
   152  
   153  Set last will message in case of Benthos failure
   154  
   155  
   156  Type: `object`  
   157  
   158  ### `will.enabled`
   159  
   160  Whether to enable last will messages.
   161  
   162  
   163  Type: `bool`  
   164  Default: `false`  
   165  
   166  ### `will.qos`
   167  
   168  Set QoS for last will message.
   169  
   170  
   171  Type: `int`  
   172  Default: `0`  
   173  Options: `0`, `1`, `2`.
   174  
   175  ### `will.retained`
   176  
   177  Set retained for last will message.
   178  
   179  
   180  Type: `bool`  
   181  Default: `false`  
   182  
   183  ### `will.topic`
   184  
   185  Set topic for last will message.
   186  
   187  
   188  Type: `string`  
   189  Default: `""`  
   190  
   191  ### `will.payload`
   192  
   193  Set payload for last will message.
   194  
   195  
   196  Type: `string`  
   197  Default: `""`  
   198  
   199  ### `connect_timeout`
   200  
   201  The maximum amount of time to wait in order to establish a connection before the attempt is abandoned.
   202  
   203  
   204  Type: `string`  
   205  Default: `"30s"`  
   206  Requires version 3.58.0 or newer  
   207  
   208  ```yaml
   209  # Examples
   210  
   211  connect_timeout: 1s
   212  
   213  connect_timeout: 500ms
   214  ```
   215  
   216  ### `user`
   217  
   218  A username to assume for the connection.
   219  
   220  
   221  Type: `string`  
   222  Default: `""`  
   223  
   224  ### `password`
   225  
   226  A password to provide for the connection.
   227  
   228  
   229  Type: `string`  
   230  Default: `""`  
   231  
   232  ### `keepalive`
   233  
   234  Max seconds of inactivity before a keepalive message is sent.
   235  
   236  
   237  Type: `int`  
   238  Default: `30`  
   239  
   240  ### `tls`
   241  
   242  Custom TLS settings can be used to override system defaults.
   243  
   244  
   245  Type: `object`  
   246  Requires version 3.45.0 or newer  
   247  
   248  ### `tls.enabled`
   249  
   250  Whether custom TLS settings are enabled.
   251  
   252  
   253  Type: `bool`  
   254  Default: `false`  
   255  
   256  ### `tls.skip_cert_verify`
   257  
   258  Whether to skip server side certificate verification.
   259  
   260  
   261  Type: `bool`  
   262  Default: `false`  
   263  
   264  ### `tls.enable_renegotiation`
   265  
   266  Whether to allow the remote server to repeatedly request renegotiation. Enable this option if you're seeing the error message `local error: tls: no renegotiation`.
   267  
   268  
   269  Type: `bool`  
   270  Default: `false`  
   271  Requires version 3.45.0 or newer  
   272  
   273  ### `tls.root_cas`
   274  
   275  An optional root certificate authority to use. This is a string, representing a certificate chain from the parent trusted root certificate, to possible intermediate signing certificates, to the host certificate.
   276  
   277  
   278  Type: `string`  
   279  Default: `""`  
   280  
   281  ```yaml
   282  # Examples
   283  
   284  root_cas: |-
   285    -----BEGIN CERTIFICATE-----
   286    ...
   287    -----END CERTIFICATE-----
   288  ```
   289  
   290  ### `tls.root_cas_file`
   291  
   292  An optional path of a root certificate authority file to use. This is a file, often with a .pem extension, containing a certificate chain from the parent trusted root certificate, to possible intermediate signing certificates, to the host certificate.
   293  
   294  
   295  Type: `string`  
   296  Default: `""`  
   297  
   298  ```yaml
   299  # Examples
   300  
   301  root_cas_file: ./root_cas.pem
   302  ```
   303  
   304  ### `tls.client_certs`
   305  
   306  A list of client certificates to use. For each certificate either the fields `cert` and `key`, or `cert_file` and `key_file` should be specified, but not both.
   307  
   308  
   309  Type: `array`  
   310  Default: `[]`  
   311  
   312  ```yaml
   313  # Examples
   314  
   315  client_certs:
   316    - cert: foo
   317      key: bar
   318  
   319  client_certs:
   320    - cert_file: ./example.pem
   321      key_file: ./example.key
   322  ```
   323  
   324  ### `tls.client_certs[].cert`
   325  
   326  A plain text certificate to use.
   327  
   328  
   329  Type: `string`  
   330  Default: `""`  
   331  
   332  ### `tls.client_certs[].key`
   333  
   334  A plain text certificate key to use.
   335  
   336  
   337  Type: `string`  
   338  Default: `""`  
   339  
   340  ### `tls.client_certs[].cert_file`
   341  
   342  The path to a certificate to use.
   343  
   344  
   345  Type: `string`  
   346  Default: `""`  
   347  
   348  ### `tls.client_certs[].key_file`
   349  
   350  The path of a certificate key to use.
   351  
   352  
   353  Type: `string`  
   354  Default: `""`  
   355  
   356