nats_kv
This component is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with the component is found.
Watches for updates in a NATS key-value bucket.
Introduced in version 4.12.0.
- Common
- Advanced
# Common config fields, showing default values
input:
label: ""
nats_kv:
urls: [] # No default (required)
bucket: my_kv_bucket # No default (required)
key: '>'
# All config fields, showing default values
input:
label: ""
nats_kv:
urls: [] # No default (required)
bucket: my_kv_bucket # No default (required)
key: '>'
ignore_deletes: false
include_history: false
meta_only: false
tls:
enabled: false
skip_cert_verify: false
enable_renegotiation: false
root_cas: ""
root_cas_file: ""
client_certs: []
auth:
nkey_file: ./seed.nk # No default (optional)
user_credentials_file: ./user.creds # No default (optional)
user_jwt: "" # No default (optional)
user_nkey_seed: "" # No default (optional)
Metadata
This input adds the following metadata fields to each message:
- nats_kv_key
- nats_kv_bucket
- nats_kv_revision
- nats_kv_delta
- nats_kv_operation
- nats_kv_created
Connection Name
When monitoring and managing a production NATS system, it is often useful to know which connection a message was send/received from. This can be achieved by setting the connection name option when creating a NATS connection.
Benthos will automatically set the connection name based off the label of the given NATS component, so that monitoring tools between NATS and benthos can stay in sync.
Authentication
There are several components within Benthos which utilise NATS services. You will find that each of these components support optional advanced authentication parameters for NKeys and User Credentials.
An in depth tutorial can be found here.
NKey file
The NATS server can use these NKeys in several ways for authentication. The simplest is for the server to be configured
with a list of known public keys and for the clients to respond to the challenge by signing it with its private NKey
configured in the nkey_file field.
More details here.
User Credentials
NATS server supports decentralized authentication based on JSON Web Tokens (JWT). Clients need an user JWT and a corresponding NKey secret when connecting to a server which is configured to use this authentication scheme.
The user_credentials_file field should point to a file containing both the private key and the JWT and can be
generated with the nsc tool.
Alternatively, the user_jwt field can contain a plain text JWT and the user_nkey_seedcan contain
the plain text NKey Seed.
More details here.
Fields
urls
A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.
Type: array
# Examples
urls:
- nats://127.0.0.1:4222
urls:
- nats://username:password@127.0.0.1:4222
bucket
The name of the KV bucket to watch for updates.
Type: string
# Examples
bucket: my_kv_bucket
key
Key to watch for updates, can include wildcards.
Type: string
Default: "\u003e"
# Examples
key: foo.bar.baz
key: foo.*.baz
key: foo.bar.*
key: foo.>
ignore_deletes
Do not send delete markers as messages.
Type: bool
Default: false