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

     1  ---
     2  title: nats_jetstream
     3  type: output
     4  status: experimental
     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_jetstream.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  :::caution EXPERIMENTAL
    19  This component is experimental and therefore subject to change or removal outside of major version releases.
    20  :::
    21  Write messages to a NATS JetStream subject.
    22  
    23  Introduced in version 3.46.0.
    24  
    25  
    26  <Tabs defaultValue="common" values={[
    27    { label: 'Common', value: 'common', },
    28    { label: 'Advanced', value: 'advanced', },
    29  ]}>
    30  
    31  <TabItem value="common">
    32  
    33  ```yaml
    34  # Common config fields, showing default values
    35  output:
    36    label: ""
    37    nats_jetstream:
    38      urls:
    39        - nats://127.0.0.1:4222
    40      subject: ""
    41      max_in_flight: 1024
    42  ```
    43  
    44  </TabItem>
    45  <TabItem value="advanced">
    46  
    47  ```yaml
    48  # All config fields, showing default values
    49  output:
    50    label: ""
    51    nats_jetstream:
    52      urls:
    53        - nats://127.0.0.1:4222
    54      subject: ""
    55      max_in_flight: 1024
    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  ## Fields
    99  
   100  ### `urls`
   101  
   102  A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.
   103  
   104  
   105  Type: `array`  
   106  
   107  ```yaml
   108  # Examples
   109  
   110  urls:
   111    - nats://127.0.0.1:4222
   112  
   113  urls:
   114    - nats://username:password@127.0.0.1:4222
   115  ```
   116  
   117  ### `subject`
   118  
   119  A subject to write to.
   120  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
   121  
   122  
   123  Type: `string`  
   124  
   125  ```yaml
   126  # Examples
   127  
   128  subject: foo.bar.baz
   129  
   130  subject: ${! meta("kafka_topic") }
   131  
   132  subject: foo.${! json("meta.type") }
   133  ```
   134  
   135  ### `max_in_flight`
   136  
   137  The maximum number of messages to have in flight at a given time. Increase this to improve throughput.
   138  
   139  
   140  Type: `int`  
   141  Default: `1024`  
   142  
   143  ### `tls`
   144  
   145  Custom TLS settings can be used to override system defaults.
   146  
   147  
   148  Type: `object`  
   149  
   150  ### `tls.enabled`
   151  
   152  Whether custom TLS settings are enabled.
   153  
   154  
   155  Type: `bool`  
   156  Default: `false`  
   157  
   158  ### `tls.skip_cert_verify`
   159  
   160  Whether to skip server side certificate verification.
   161  
   162  
   163  Type: `bool`  
   164  Default: `false`  
   165  
   166  ### `tls.enable_renegotiation`
   167  
   168  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`.
   169  
   170  
   171  Type: `bool`  
   172  Default: `false`  
   173  Requires version 3.45.0 or newer  
   174  
   175  ### `tls.root_cas`
   176  
   177  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.
   178  
   179  
   180  Type: `string`  
   181  Default: `""`  
   182  
   183  ```yaml
   184  # Examples
   185  
   186  root_cas: |-
   187    -----BEGIN CERTIFICATE-----
   188    ...
   189    -----END CERTIFICATE-----
   190  ```
   191  
   192  ### `tls.root_cas_file`
   193  
   194  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.
   195  
   196  
   197  Type: `string`  
   198  Default: `""`  
   199  
   200  ```yaml
   201  # Examples
   202  
   203  root_cas_file: ./root_cas.pem
   204  ```
   205  
   206  ### `tls.client_certs`
   207  
   208  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.
   209  
   210  
   211  Type: `array`  
   212  
   213  ```yaml
   214  # Examples
   215  
   216  client_certs:
   217    - cert: foo
   218      key: bar
   219  
   220  client_certs:
   221    - cert_file: ./example.pem
   222      key_file: ./example.key
   223  ```
   224  
   225  ### `tls.client_certs[].cert`
   226  
   227  A plain text certificate to use.
   228  
   229  
   230  Type: `string`  
   231  Default: `""`  
   232  
   233  ### `tls.client_certs[].key`
   234  
   235  A plain text certificate key to use.
   236  
   237  
   238  Type: `string`  
   239  Default: `""`  
   240  
   241  ### `tls.client_certs[].cert_file`
   242  
   243  The path to a certificate to use.
   244  
   245  
   246  Type: `string`  
   247  Default: `""`  
   248  
   249  ### `tls.client_certs[].key_file`
   250  
   251  The path of a certificate key to use.
   252  
   253  
   254  Type: `string`  
   255  Default: `""`  
   256  
   257  ### `auth`
   258  
   259  Optional configuration of NATS authentication parameters.
   260  
   261  
   262  Type: `object`  
   263  
   264  ### `auth.nkey_file`
   265  
   266  An optional file containing a NKey seed.
   267  
   268  
   269  Type: `string`  
   270  
   271  ```yaml
   272  # Examples
   273  
   274  nkey_file: ./seed.nk
   275  ```
   276  
   277  ### `auth.user_credentials_file`
   278  
   279  An optional file containing user credentials which consist of an user JWT and corresponding NKey seed.
   280  
   281  
   282  Type: `string`  
   283  
   284  ```yaml
   285  # Examples
   286  
   287  user_credentials_file: ./user.creds
   288  ```
   289  
   290