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

     1  ---
     2  title: nats_jetstream
     3  type: input
     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/input/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  Reads messages from NATS JetStream subjects.
    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  input:
    36    label: ""
    37    nats_jetstream:
    38      urls:
    39        - nats://127.0.0.1:4222
    40      queue: ""
    41      subject: ""
    42      durable: ""
    43      deliver: all
    44  ```
    45  
    46  </TabItem>
    47  <TabItem value="advanced">
    48  
    49  ```yaml
    50  # All config fields, showing default values
    51  input:
    52    label: ""
    53    nats_jetstream:
    54      urls:
    55        - nats://127.0.0.1:4222
    56      queue: ""
    57      subject: ""
    58      durable: ""
    59      deliver: all
    60      ack_wait: 30s
    61      max_ack_pending: 1024
    62      tls:
    63        enabled: false
    64        skip_cert_verify: false
    65        enable_renegotiation: false
    66        root_cas: ""
    67        root_cas_file: ""
    68        client_certs: []
    69      auth:
    70        nkey_file: ""
    71        user_credentials_file: ""
    72  ```
    73  
    74  </TabItem>
    75  </Tabs>
    76  
    77  ### Metadata
    78  
    79  This input adds the following metadata fields to each message:
    80  
    81  ```text
    82  - nats_subject
    83  ```
    84  
    85  You can access these metadata fields using
    86  [function interpolation](/docs/configuration/interpolation#metadata).
    87  
    88  ### Authentication
    89  
    90  There are several components within Benthos which utilise NATS services. You will find that each of these components
    91  support optional advanced authentication parameters for [NKeys](https://docs.nats.io/nats-server/configuration/securing_nats/auth_intro/nkey_auth)
    92  and [User Credentials](https://docs.nats.io/developing-with-nats/security/creds).
    93  
    94  An in depth tutorial can be found [here](https://docs.nats.io/developing-with-nats/tutorials/jwt).
    95  
    96  #### NKey file
    97  
    98  The NATS server can use these NKeys in several ways for authentication. The simplest is for the server to be configured
    99  with a list of known public keys and for the clients to respond to the challenge by signing it with its private NKey
   100  configured in the `nkey_file` field.
   101  
   102  More details [here](https://docs.nats.io/developing-with-nats/security/nkey).
   103  
   104  #### User Credentials file
   105  
   106  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)
   107  and a corresponding [NKey secret](https://docs.nats.io/developing-with-nats/security/nkey) when connecting to a server
   108  which is configured to use this authentication scheme.
   109  
   110  The `user_credentials_file` field should point to a file containing both the private key and the JWT and can be
   111  generated with the [nsc tool](https://docs.nats.io/nats-tools/nsc).
   112  
   113  More details [here](https://docs.nats.io/developing-with-nats/security/creds).
   114  
   115  ## Fields
   116  
   117  ### `urls`
   118  
   119  A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.
   120  
   121  
   122  Type: `array`  
   123  
   124  ```yaml
   125  # Examples
   126  
   127  urls:
   128    - nats://127.0.0.1:4222
   129  
   130  urls:
   131    - nats://username:password@127.0.0.1:4222
   132  ```
   133  
   134  ### `queue`
   135  
   136  An optional queue group to consume as.
   137  
   138  
   139  Type: `string`  
   140  
   141  ### `subject`
   142  
   143  A subject to consume from. Supports wildcards for consuming multiple subjects.
   144  
   145  
   146  Type: `string`  
   147  
   148  ```yaml
   149  # Examples
   150  
   151  subject: foo.bar.baz
   152  
   153  subject: foo.*.baz
   154  
   155  subject: foo.bar.*
   156  
   157  subject: foo.>
   158  ```
   159  
   160  ### `durable`
   161  
   162  Preserve the state of your consumer under a durable name.
   163  
   164  
   165  Type: `string`  
   166  
   167  ### `deliver`
   168  
   169  Determines which messages to deliver when consuming without a durable subscriber.
   170  
   171  
   172  Type: `string`  
   173  Default: `"all"`  
   174  
   175  | Option | Summary |
   176  |---|---|
   177  | `all` | Deliver all available messages. |
   178  | `last` | Deliver starting with the last published messages. |
   179  
   180  
   181  ### `ack_wait`
   182  
   183  The maximum amount of time NATS server should wait for an ack from consumer.
   184  
   185  
   186  Type: `string`  
   187  Default: `"30s"`  
   188  
   189  ```yaml
   190  # Examples
   191  
   192  ack_wait: 100ms
   193  
   194  ack_wait: 5m
   195  ```
   196  
   197  ### `max_ack_pending`
   198  
   199  The maximum number of outstanding acks to be allowed before consuming is halted.
   200  
   201  
   202  Type: `int`  
   203  Default: `1024`  
   204  
   205  ### `tls`
   206  
   207  Custom TLS settings can be used to override system defaults.
   208  
   209  
   210  Type: `object`  
   211  
   212  ### `tls.enabled`
   213  
   214  Whether custom TLS settings are enabled.
   215  
   216  
   217  Type: `bool`  
   218  Default: `false`  
   219  
   220  ### `tls.skip_cert_verify`
   221  
   222  Whether to skip server side certificate verification.
   223  
   224  
   225  Type: `bool`  
   226  Default: `false`  
   227  
   228  ### `tls.enable_renegotiation`
   229  
   230  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`.
   231  
   232  
   233  Type: `bool`  
   234  Default: `false`  
   235  Requires version 3.45.0 or newer  
   236  
   237  ### `tls.root_cas`
   238  
   239  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.
   240  
   241  
   242  Type: `string`  
   243  Default: `""`  
   244  
   245  ```yaml
   246  # Examples
   247  
   248  root_cas: |-
   249    -----BEGIN CERTIFICATE-----
   250    ...
   251    -----END CERTIFICATE-----
   252  ```
   253  
   254  ### `tls.root_cas_file`
   255  
   256  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.
   257  
   258  
   259  Type: `string`  
   260  Default: `""`  
   261  
   262  ```yaml
   263  # Examples
   264  
   265  root_cas_file: ./root_cas.pem
   266  ```
   267  
   268  ### `tls.client_certs`
   269  
   270  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.
   271  
   272  
   273  Type: `array`  
   274  
   275  ```yaml
   276  # Examples
   277  
   278  client_certs:
   279    - cert: foo
   280      key: bar
   281  
   282  client_certs:
   283    - cert_file: ./example.pem
   284      key_file: ./example.key
   285  ```
   286  
   287  ### `tls.client_certs[].cert`
   288  
   289  A plain text certificate to use.
   290  
   291  
   292  Type: `string`  
   293  Default: `""`  
   294  
   295  ### `tls.client_certs[].key`
   296  
   297  A plain text certificate key to use.
   298  
   299  
   300  Type: `string`  
   301  Default: `""`  
   302  
   303  ### `tls.client_certs[].cert_file`
   304  
   305  The path to a certificate to use.
   306  
   307  
   308  Type: `string`  
   309  Default: `""`  
   310  
   311  ### `tls.client_certs[].key_file`
   312  
   313  The path of a certificate key to use.
   314  
   315  
   316  Type: `string`  
   317  Default: `""`  
   318  
   319  ### `auth`
   320  
   321  Optional configuration of NATS authentication parameters.
   322  
   323  
   324  Type: `object`  
   325  
   326  ### `auth.nkey_file`
   327  
   328  An optional file containing a NKey seed.
   329  
   330  
   331  Type: `string`  
   332  
   333  ```yaml
   334  # Examples
   335  
   336  nkey_file: ./seed.nk
   337  ```
   338  
   339  ### `auth.user_credentials_file`
   340  
   341  An optional file containing user credentials which consist of an user JWT and corresponding NKey seed.
   342  
   343  
   344  Type: `string`  
   345  
   346  ```yaml
   347  # Examples
   348  
   349  user_credentials_file: ./user.creds
   350  ```
   351  
   352