> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon Kinesis Data Streams

> Read one shard by sequence and publish records through SigV4.

Mount `@bijectionhq/app-streams` with a regional Kinesis receiver as its
`kinesis`. Use an AWS session authorized for `kinesis:GetShardIterator`,
`kinesis:GetRecords`, and `kinesis:PutRecord` on the selected stream, and
set it with `bijection secret set session`. Pass the same
[label](https://docs.bijection.com/integrations/native-connectors.md#installer-bound-labels) to the receiver binder and
as the app's `data`.

```ts bijection/app.ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { app, label, secret } from "@bijectionhq/bijection";
import streams, { kinesisReceiver } from "@bijectionhq/app-streams";

const orders = label();
const session = secret();
const kinesis = kinesisReceiver("us-east-1", session, orders);

export default app({ orders, session, kinesis, streams: streams({ data: orders, kinesis }) });
```

Grant `streams.operator` and call `streams.kinesis.initialize` with:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{ streamArn: "arn:aws:kinesis:us-east-1:111122223333:stream/orders", shardId: "shardId-000000000000" }
```

Use a fresh mount for a different stream incarnation or shard. The baseline
starts at `TRIM_HORIZON`. Each `GetRecords` asks for one record with an
11 KiB payload limit. The app stores the exact sequence number as text,
the record bytes as a File, and the partition key and approximate arrival
time as metadata. The File and sequence position commit together. A duplicate
provider sequence resolves to the same event. Kinesis has no reader
acknowledgement. A closed shard finishes after its last accepted batch.
Shard discovery and following child shards are outside this mode.

The app uses the returned iterator as a short-lived hint and reopens an
expired hint from the last sequence. When a reopen cannot establish continuity,
including a retained anchor at least 23 hours old, the app stops and keeps
the last position. Use `health` to inspect the gap. Call `reset` with the
displayed revision and gap stamp to accept a new trim-horizon baseline.
A reset keeps published events. Oversized input also leaves the
position intact. Provider removal and empty reads leave retained Files intact.

Call `publish({ command, partition, message })` to submit at most 11 KiB of
UTF-8 data. Kinesis chooses the receiver shard for that partition key.
`publishStatus({ command })` reports the shard and exact sequence from a
successful receipt. The host sends each task at most once. A repeated
command must carry the same request and returns its retained disposition.
An ambiguous send stays unknown and the app does not resend it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.