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

     1  ---
     2  title: nats_stream
     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/nats_stream.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  
    19  Publish to a NATS Stream subject.
    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    nats_stream:
    34      urls:
    35        - nats://127.0.0.1:4222
    36      cluster_id: test-cluster
    37      subject: benthos_messages
    38      client_id: benthos_client
    39      max_in_flight: 1
    40  ```
    41  
    42  </TabItem>
    43  <TabItem value="advanced">
    44  
    45  ```yaml
    46  # All config fields, showing default values
    47  output:
    48    label: ""
    49    nats_stream:
    50      urls:
    51        - nats://127.0.0.1:4222
    52      cluster_id: test-cluster
    53      subject: benthos_messages
    54      client_id: benthos_client
    55      max_in_flight: 1
    56      tls:
    57        enabled: false
    58        skip_cert_verify: false
    59        enable_renegotiation: false
    60        root_cas: ""
    61        root_cas_file: ""
    62        client_certs: []
    63      auth:
    64        nkey_file: ""
    65        user_credentials_file: ""
    66  ```
    67  
    68  </TabItem>
    69  </Tabs>
    70  
    71  ### Authentication
    72  
    73  There are several components within Benthos which utilise NATS services. You will find that each of these components
    74  support optional advanced authentication parameters for [NKeys](https://docs.nats.io/nats-server/configuration/securing_nats/auth_intro/nkey_auth)
    75  and [User Credentials](https://docs.nats.io/developing-with-nats/security/creds).
    76  
    77  An in depth tutorial can be found [here](https://docs.nats.io/developing-with-nats/tutorials/jwt).
    78  
    79  #### NKey file
    80  
    81  The NATS server can use these NKeys in several ways for authentication. The simplest is for the server to be configured
    82  with a list of known public keys and for the clients to respond to the challenge by signing it with its private NKey
    83  configured in the `nkey_file` field.
    84  
    85  More details [here](https://docs.nats.io/developing-with-nats/security/nkey).
    86  
    87  #### User Credentials file
    88  
    89  NATS server supports decentralized authentication based on JSON Web Tokens (JWT). Clients need an [user JWT](https://docs.nats.io/nats-server/configuration/securing_nats/jwt#json-web-tokens)
    90  and a corresponding [NKey secret](https://docs.nats.io/developing-with-nats/security/nkey) when connecting to a server
    91  which is configured to use this authentication scheme.
    92  
    93  The `user_credentials_file` field should point to a file containing both the private key and the JWT and can be
    94  generated with the [nsc tool](https://docs.nats.io/nats-tools/nsc).
    95  
    96  More details [here](https://docs.nats.io/developing-with-nats/security/creds).
    97  
    98  ## Performance
    99  
   100  This output benefits from sending multiple messages in flight in parallel for
   101  improved performance. You can tune the max number of in flight messages with the
   102  field `max_in_flight`.
   103  
   104  ## Fields
   105  
   106  ### `urls`
   107  
   108  A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.
   109  
   110  
   111  Type: `array`  
   112  Default: `["nats://127.0.0.1:4222"]`  
   113  
   114  ```yaml
   115  # Examples
   116  
   117  urls:
   118    - nats://127.0.0.1:4222
   119  
   120  urls:
   121    - nats://username:password@127.0.0.1:4222
   122  ```
   123  
   124  ### `cluster_id`
   125  
   126  The cluster ID to publish to.
   127  
   128  
   129  Type: `string`  
   130  Default: `"test-cluster"`  
   131  
   132  ### `subject`
   133  
   134  The subject to publish to.
   135  
   136  
   137  Type: `string`  
   138  Default: `"benthos_messages"`  
   139  
   140  ### `client_id`
   141  
   142  The client ID to connect with.
   143  
   144  
   145  Type: `string`  
   146  Default: `"benthos_client"`  
   147  
   148  ### `max_in_flight`
   149  
   150  The maximum number of messages to have in flight at a given time. Increase this to improve throughput.
   151  
   152  
   153  Type: `int`  
   154  Default: `1`  
   155  
   156  ### `tls`
   157  
   158  Custom TLS settings can be used to override system defaults.
   159  
   160  
   161  Type: `object`  
   162  
   163  ### `tls.enabled`
   164  
   165  Whether custom TLS settings are enabled.
   166  
   167  
   168  Type: `bool`  
   169  Default: `false`  
   170  
   171  ### `tls.skip_cert_verify`
   172  
   173  Whether to skip server side certificate verification.
   174  
   175  
   176  Type: `bool`  
   177  Default: `false`  
   178  
   179  ### `tls.enable_renegotiation`
   180  
   181  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`.
   182  
   183  
   184  Type: `bool`  
   185  Default: `false`  
   186  Requires version 3.45.0 or newer  
   187  
   188  ### `tls.root_cas`
   189  
   190  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.
   191  
   192  
   193  Type: `string`  
   194  Default: `""`  
   195  
   196  ```yaml
   197  # Examples
   198  
   199  root_cas: |-
   200    -----BEGIN CERTIFICATE-----
   201    ...
   202    -----END CERTIFICATE-----
   203  ```
   204  
   205  ### `tls.root_cas_file`
   206  
   207  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.
   208  
   209  
   210  Type: `string`  
   211  Default: `""`  
   212  
   213  ```yaml
   214  # Examples
   215  
   216  root_cas_file: ./root_cas.pem
   217  ```
   218  
   219  ### `tls.client_certs`
   220  
   221  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.
   222  
   223  
   224  Type: `array`  
   225  Default: `[]`  
   226  
   227  ```yaml
   228  # Examples
   229  
   230  client_certs:
   231    - cert: foo
   232      key: bar
   233  
   234  client_certs:
   235    - cert_file: ./example.pem
   236      key_file: ./example.key
   237  ```
   238  
   239  ### `tls.client_certs[].cert`
   240  
   241  A plain text certificate to use.
   242  
   243  
   244  Type: `string`  
   245  Default: `""`  
   246  
   247  ### `tls.client_certs[].key`
   248  
   249  A plain text certificate key to use.
   250  
   251  
   252  Type: `string`  
   253  Default: `""`  
   254  
   255  ### `tls.client_certs[].cert_file`
   256  
   257  The path to a certificate to use.
   258  
   259  
   260  Type: `string`  
   261  Default: `""`  
   262  
   263  ### `tls.client_certs[].key_file`
   264  
   265  The path of a certificate key to use.
   266  
   267  
   268  Type: `string`  
   269  Default: `""`  
   270  
   271  ### `auth`
   272  
   273  Optional configuration of NATS authentication parameters.
   274  
   275  
   276  Type: `object`  
   277  
   278  ### `auth.nkey_file`
   279  
   280  An optional file containing a NKey seed.
   281  
   282  
   283  Type: `string`  
   284  Default: `""`  
   285  
   286  ```yaml
   287  # Examples
   288  
   289  nkey_file: ./seed.nk
   290  ```
   291  
   292  ### `auth.user_credentials_file`
   293  
   294  An optional file containing user credentials which consist of an user JWT and corresponding NKey seed.
   295  
   296  
   297  Type: `string`  
   298  Default: `""`  
   299  
   300  ```yaml
   301  # Examples
   302  
   303  user_credentials_file: ./user.creds
   304  ```
   305  
   306