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

     1  ---
     2  title: mqtt
     3  type: output
     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/output/mqtt.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  
    19  Pushes messages to an MQTT broker.
    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  output:
    32    label: ""
    33    mqtt:
    34      urls:
    35        - tcp://localhost:1883
    36      topic: benthos_topic
    37      client_id: benthos_output
    38      qos: 1
    39      connect_timeout: 30s
    40      write_timeout: 3s
    41      retained: false
    42      max_in_flight: 1
    43  ```
    44  
    45  </TabItem>
    46  <TabItem value="advanced">
    47  
    48  ```yaml
    49  # All config fields, showing default values
    50  output:
    51    label: ""
    52    mqtt:
    53      urls:
    54        - tcp://localhost:1883
    55      topic: benthos_topic
    56      client_id: benthos_output
    57      dynamic_client_id_suffix: ""
    58      qos: 1
    59      connect_timeout: 30s
    60      write_timeout: 3s
    61      retained: false
    62      retained_interpolated: ""
    63      will:
    64        enabled: false
    65        qos: 0
    66        retained: false
    67        topic: ""
    68        payload: ""
    69      user: ""
    70      password: ""
    71      keepalive: 30
    72      tls:
    73        enabled: false
    74        skip_cert_verify: false
    75        enable_renegotiation: false
    76        root_cas: ""
    77        root_cas_file: ""
    78        client_certs: []
    79      max_in_flight: 1
    80  ```
    81  
    82  </TabItem>
    83  </Tabs>
    84  
    85  The `topic` field can be dynamically set using function interpolations
    86  described [here](/docs/configuration/interpolation#bloblang-queries). When sending batched
    87  messages these interpolations are performed per message part.
    88  
    89  ## Performance
    90  
    91  This output benefits from sending multiple messages in flight in parallel for
    92  improved performance. You can tune the max number of in flight messages with the
    93  field `max_in_flight`.
    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  ```yaml
   106  # Examples
   107  
   108  urls:
   109    - tcp://localhost:1883
   110  ```
   111  
   112  ### `topic`
   113  
   114  The topic to publish messages to.
   115  
   116  
   117  Type: `string`  
   118  Default: `"benthos_topic"`  
   119  
   120  ### `client_id`
   121  
   122  An identifier for the client connection.
   123  
   124  
   125  Type: `string`  
   126  Default: `"benthos_output"`  
   127  
   128  ### `dynamic_client_id_suffix`
   129  
   130  Append a dynamically generated suffix to the specified `client_id` on each run of the pipeline. This can be useful when clustering Benthos producers.
   131  
   132  
   133  Type: `string`  
   134  Default: `""`  
   135  
   136  | Option | Summary |
   137  |---|---|
   138  | `nanoid` | append a nanoid of length 21 characters |
   139  
   140  
   141  ### `qos`
   142  
   143  The QoS value to set for each message.
   144  
   145  
   146  Type: `int`  
   147  Default: `1`  
   148  Options: `0`, `1`, `2`.
   149  
   150  ### `connect_timeout`
   151  
   152  The maximum amount of time to wait in order to establish a connection before the attempt is abandoned.
   153  
   154  
   155  Type: `string`  
   156  Default: `"30s"`  
   157  Requires version 3.58.0 or newer  
   158  
   159  ```yaml
   160  # Examples
   161  
   162  connect_timeout: 1s
   163  
   164  connect_timeout: 500ms
   165  ```
   166  
   167  ### `write_timeout`
   168  
   169  The maximum amount of time to wait to write data before the attempt is abandoned.
   170  
   171  
   172  Type: `string`  
   173  Default: `"3s"`  
   174  Requires version 3.58.0 or newer  
   175  
   176  ```yaml
   177  # Examples
   178  
   179  write_timeout: 1s
   180  
   181  write_timeout: 500ms
   182  ```
   183  
   184  ### `retained`
   185  
   186  Set message as retained on the topic.
   187  
   188  
   189  Type: `bool`  
   190  Default: `false`  
   191  
   192  ### `retained_interpolated`
   193  
   194  Override the value of `retained` with an interpolable value, this allows it to be dynamically set based on message contents. The value must resolve to either `true` or `false`.
   195  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
   196  
   197  
   198  Type: `string`  
   199  Default: `""`  
   200  Requires version 3.59.0 or newer  
   201  
   202  ### `will`
   203  
   204  Set last will message in case of Benthos failure
   205  
   206  
   207  Type: `object`  
   208  
   209  ### `will.enabled`
   210  
   211  Whether to enable last will messages.
   212  
   213  
   214  Type: `bool`  
   215  Default: `false`  
   216  
   217  ### `will.qos`
   218  
   219  Set QoS for last will message.
   220  
   221  
   222  Type: `int`  
   223  Default: `0`  
   224  Options: `0`, `1`, `2`.
   225  
   226  ### `will.retained`
   227  
   228  Set retained for last will message.
   229  
   230  
   231  Type: `bool`  
   232  Default: `false`  
   233  
   234  ### `will.topic`
   235  
   236  Set topic for last will message.
   237  
   238  
   239  Type: `string`  
   240  Default: `""`  
   241  
   242  ### `will.payload`
   243  
   244  Set payload for last will message.
   245  
   246  
   247  Type: `string`  
   248  Default: `""`  
   249  
   250  ### `user`
   251  
   252  A username to connect with.
   253  
   254  
   255  Type: `string`  
   256  Default: `""`  
   257  
   258  ### `password`
   259  
   260  A password to connect with.
   261  
   262  
   263  Type: `string`  
   264  Default: `""`  
   265  
   266  ### `keepalive`
   267  
   268  Max seconds of inactivity before a keepalive message is sent.
   269  
   270  
   271  Type: `int`  
   272  Default: `30`  
   273  
   274  ### `tls`
   275  
   276  Custom TLS settings can be used to override system defaults.
   277  
   278  
   279  Type: `object`  
   280  Requires version 3.45.0 or newer  
   281  
   282  ### `tls.enabled`
   283  
   284  Whether custom TLS settings are enabled.
   285  
   286  
   287  Type: `bool`  
   288  Default: `false`  
   289  
   290  ### `tls.skip_cert_verify`
   291  
   292  Whether to skip server side certificate verification.
   293  
   294  
   295  Type: `bool`  
   296  Default: `false`  
   297  
   298  ### `tls.enable_renegotiation`
   299  
   300  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`.
   301  
   302  
   303  Type: `bool`  
   304  Default: `false`  
   305  Requires version 3.45.0 or newer  
   306  
   307  ### `tls.root_cas`
   308  
   309  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.
   310  
   311  
   312  Type: `string`  
   313  Default: `""`  
   314  
   315  ```yaml
   316  # Examples
   317  
   318  root_cas: |-
   319    -----BEGIN CERTIFICATE-----
   320    ...
   321    -----END CERTIFICATE-----
   322  ```
   323  
   324  ### `tls.root_cas_file`
   325  
   326  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.
   327  
   328  
   329  Type: `string`  
   330  Default: `""`  
   331  
   332  ```yaml
   333  # Examples
   334  
   335  root_cas_file: ./root_cas.pem
   336  ```
   337  
   338  ### `tls.client_certs`
   339  
   340  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.
   341  
   342  
   343  Type: `array`  
   344  Default: `[]`  
   345  
   346  ```yaml
   347  # Examples
   348  
   349  client_certs:
   350    - cert: foo
   351      key: bar
   352  
   353  client_certs:
   354    - cert_file: ./example.pem
   355      key_file: ./example.key
   356  ```
   357  
   358  ### `tls.client_certs[].cert`
   359  
   360  A plain text certificate to use.
   361  
   362  
   363  Type: `string`  
   364  Default: `""`  
   365  
   366  ### `tls.client_certs[].key`
   367  
   368  A plain text certificate key to use.
   369  
   370  
   371  Type: `string`  
   372  Default: `""`  
   373  
   374  ### `tls.client_certs[].cert_file`
   375  
   376  The path to a certificate to use.
   377  
   378  
   379  Type: `string`  
   380  Default: `""`  
   381  
   382  ### `tls.client_certs[].key_file`
   383  
   384  The path of a certificate key to use.
   385  
   386  
   387  Type: `string`  
   388  Default: `""`  
   389  
   390  ### `max_in_flight`
   391  
   392  The maximum number of messages to have in flight at a given time. Increase this to improve throughput.
   393  
   394  
   395  Type: `int`  
   396  Default: `1`  
   397  
   398