Bump github.com/nats-io/nats-server/v2 from 2.9.16 to 2.9.23 (#3)
Bumps github.com/nats-io/nats-server/v2 from 2.9.16 to 2.9.23.
updated-dependencies:
- dependency-name: github.com/nats-io/nats-server/v2 dependency-type: direct:production …
Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Kinesis-NATS Bridge
The is a standalone program that reads records from AWS Kinesis streams and publishes them to NATS streams.
Configuration
A configuration file is used to delcare the Kinesis streams and their mapping to a NATS stream. Here is an example:
Subject
The defined subject and DLQ subject must be bound to a stream.
The subject supports the following template variables:
Data- For theDataproperty to be accessible, the encoding type must be supported, e.g.json. The default encoding is assumed to be an opaque bytes.PartitionKey- The partition key set on the record, if any.SequenceNumber- The sequence number of the record in the stream.ShardID- The shard ID on the stream that the record was in.Headers
When a message is republished to NATS, the following headers are set:
Kinesis-Stream-Name- Name of the stream the message was from.Kinesis-Shard-Id- ID of the shard the record was stored in.Kinesis-Partition-Key- Partition key of the record.Kinesis-Sequence-Number- Sequence number of the message within the shard.Kinesis-Arrival-Timestamp- The arrival timestamp of the record within the stream.Nats-Msg-Id- Hash of the stream name, shard, partition key, and sequence number.Setup
Before running the bridge, the streams and KV bucket must be created that match the configuration.
Create a stream
The subjects specified in the configuration must be bound to a NATS stream. For example, a stream
sensor-datacould be created with a subjectsensor-data.>which will match the messages that are successfully parsed as well as the ones needing to going into the DLQ subject.To create the stream, use
nats stream add. You will be prompted for each option, however three options that are important to define are the subjects, the replicas, and limits such as max age.Create a KV bucket
AWS credentials
The official Go SDK for AWS and Kinesis is used. The default configuration loader will use the standard
AWS_*environment variables if defined, otherwise it will fallback to thedefaultprofile in~/.aws.