Skip to main content

Crate ferrokinesis

Crate ferrokinesis 

Source
Expand description

§ferrokinesis

A local AWS Kinesis Data Streams emulator written in Rust. Aims to exactly match real AWS Kinesis behavior, making it suitable for local development and integration testing without a live AWS account.

§Quick start

use ferrokinesis::{create_app, serve_plain_http, store::StoreOptions};

#[tokio::main]
async fn main() {
    let (app, _store) = create_app(StoreOptions::default());

    let listener = tokio::net::TcpListener::bind("127.0.0.1:4567").await.unwrap();
    serve_plain_http(listener, app, async {
        let _ = tokio::signal::ctrl_c().await;
    })
        .await
        .unwrap();
}

§Architecture

HTTP POST requests arrive at server::handler, which parses the X-Amz-Target header to determine the actions::Operation, deserializes the JSON/CBOR body, runs validation, then routes to the appropriate action handler in actions.

All persistent state lives in an in-memory concurrent store wrapped by store::Store.

§AWS Kinesis documentation

See the Amazon Kinesis Data Streams API Reference for the full API specification.

Modules§

actions
Operation dispatch for the Kinesis emulator.
capture
Stream capture support and shared replay format helpers.
config
TOML configuration file loading for ferrokinesis.
error
Error types returned by the Kinesis emulator.
health
Health check endpoints for the Kinesis emulator.
server
Axum HTTP handler implementing the Kinesis wire protocol.
store
Concurrent in-memory store for streams, records, consumers, and policies.
types
Domain types mirroring the AWS Kinesis Data Streams data model.

Functions§

create_app
Creates an Axum Router and a store::Store ready to serve the Kinesis emulator.
create_app_with_capture
Like create_app, but accepts an optional capture::CaptureWriter to record PutRecord/PutRecords calls to an NDJSON file.
create_router
Creates an Axum Router around an existing store::Store.
serve_plain_http
Serve an Axum app over a plain TCP listener with HTTP/1.1 and h2c auto-negotiation.