RedCrab Italiano

RedCrab Request–reply over brokers for Event-Driven systems: Checkable Responsibility Allocation to Boundary elements

Call a service across an event broker as if it were a local method.

RedCrab wraps request–reply on Kafka, Redpanda and Apache Pulsar. A node awaits a typed method; RedCrab turns the call into a request event, matches the reply event that comes back, and returns the result or a typed failure. Streams, correlation ids and wire formats stay inside the boundary, and the services stay decoupled.

How RedCrab is adopted, step by step

$ dotnet add package RedCrab --version 1.0.2
Version 1.0.2, 28 November 2026 .NET · MIT kafka://pulsar:// Kafka, Redpanda, Apache Pulsar
Eight nodes, six calls, only events on the wire Four nodes at the top await typed methods of four nodes at the bottom as if they were local: Orders and Checkout ask Pricing for a quote, Orders and Dashboard ask Stock for a level, Checkout and Shipping ask Billing for a charge. No node talks to another. Each node is wrapped in the RedCrab boundary, which turns the call into a request event on the broker's request streams; the replier answers with a reply event on the reply streams, and the caller's await returns. Request and reply of one exchange share a colour, their correlation id. Pricing runs as two replicas in one group: each request reaches one of them. the broker · Kafka, Redpanda or Pulsar request streams reply streams Orders pricing.Quote(cart) stock.Level(sku) Checkout pricing.Quote(basket) billing.Charge(order) Shipping billing.Charge(parcel) Dashboard stock.Level(sku) Pricing · 1 IQuote Pricing · 2 IQuote Stock ILevel Billing ICharge
what the code sees: a method callwhat travels: events, through the broker; a request and its reply share a colour, their correlation idthe RedCrab boundary around each nodePricing runs as two replicas: each request reaches one
How a call travels

A method call on the outside, events on the inside

The nodes never call each other. Each one only produces and consumes events, so either side can stop, restart or scale out without the other knowing; RedCrab gives the code the shape of a call.

  1. The requestor awaits a generated method. RedCrab registers the pending call under a fresh correlation id and publishes a request event on the operation's request stream.
  2. A replier receives it. The repliers of the operation share the stream as one group, so each request is served once, by one of them; RedCrab calls the handler you wrote with typed arguments.
  3. The reply is an event too. The result, or a failure the contract declares, goes back on the reply stream with the same correlation id.
  4. The call returns. RedCrab matches the reply to the waiting call and returns the typed result or throws the typed failure. A deadline or a cancelled token ends the call; a reply that comes later goes to the node's local policy.
In code

Operations are .NET types

A node calls a generated facade and implements a generated projection. It never sees a stream, a correlation id or a wire format; the scheme of the endpoint chooses the broker.

Register the node
services.AddRedCrab()
    .AddCluster("carservices", "kafka://localhost:9092")
        .WithRequestTimeout(15000)
    .Register();
services.AddRedCrabKafka();   // or AddRedCrabPulsar()
services.AddRedCrabSdk();     // the generated facades

await provider.InitializeRedCrabAsync();
// reads the contract from the broker and checks its hash
Call, and serve
// the requesting side
var car = await carservices.GetCarDetails(carId);

// the serving side
sealed class GetCarDetailsReplier
    : CarservicesReplier.IGetCarDetails {
    public Task<CarDetailsReply> ReplyAsync(int carId)
        => …;
}
Use cases

What a node can do

19 use cases, in five groups, each with the proof that shows it today: a scenario of the live test on a real broker, or a test.

All 19 use cases, with their proofs and the code of the samples →

The criterion

Every part of a remote call has one place

The reference paper places the work a broker brings into a call, and RedCrab holds each piece where it is placed.

  1. Two questions place every responsibility: is it settled by one node or agreed among several, and would it still exist if the call were local?
  2. Four families follow from the answers, and the 15 responsibilities of one exchange each fall in one of them.
  3. Three objectives give each family one treatment, and a test of RedCrab pins every responsibility where its treatment puts it.

The criterion in full, with the paper it comes from →

Get started

From one package to a running node

Install the host and a transport from nuget.org, publish a contract, generate the node's code, and call.