@theconduit/provider-inmemory
v0.1.1
Published
In-process transport for Conduit: synchronous-style dispatch, handler subscriptions, and in-memory DLQ — ideal for unit tests, CI, and local development without brokers.
Maintainers
Readme
@theconduit/provider-inmemory
Synchronous in-process transport provider and in-memory DLQ manager for local dev, tests, and monolith mode.
Install
pnpm add @theconduit/provider-inmemoryHighlights
InMemoryProviderdispatches directly to registered handlers.InMemoryDLQManagerextends coreMapDLQManager.- Optional synthetic backlog to test backpressure behavior.
Quick start
import { ConduitBuilder, EnvelopeBuilder } from "@theconduit/core";
import { InMemoryProvider, InMemoryDLQManager } from "@theconduit/provider-inmemory";
const provider = new InMemoryProvider();
const dlq = new InMemoryDLQManager();
const builder = new ConduitBuilder();
builder
.addRoute(
builder
.route("payment.capture")
.type("COMMAND")
.via("INMEMORY")
.onExhausted("DLQ")
)
.registerProvider(provider)
.withDlqManager(dlq);
const bus = builder.build();
bus.registerCommandHandler("payment.capture", async () => {
return { status: "captured" };
});
await bus.dispatch(
EnvelopeBuilder.command("payment.capture", { payment_id: "p-1" })
.withSourceService("checkout")
.withIdempotencyKey("capture-p-1")
.build()
);
provider.setSyntheticBacklog(50);Exports
InMemoryProviderInMemoryDLQManager
Related docs
docs/guides/choosing-provider.mddocs/guides/getting-started.md
