LiteBus
CatalogDispatch

Inbox Kafka Dispatch

  • ID: dispatch.inbox.kafka
  • Name: Inbox Kafka dispatch
  • Maturity: GA
  • Summary: Publish leased inbox envelopes to Kafka topics through UseKafkaDispatch with manual offset semantics on the consumer side.

What It Does

Registers TransportInboxDispatchModule with KafkaTransportModule. DefaultDestination is the topic; route is the record key (defaults via contract name or custom resolver). Kafka transport uses manual offset commit on consume; dispatch publish does not commit offsets.

Pair Kafka dispatch with inbox idempotency and idempotent handlers. Kafka has no queue-style lease equivalent on the broker.

Packages

PackageRole
LiteBus.Inbox.Dispatch.KafkaRegistration glue
LiteBus.Inbox.DispatchShared dispatcher
LiteBus.Transport.KafkaConfluent adapter

Requires

  • dispatch.transport-core
  • transport.kafka
  • durable-core.inbox

Invariants

  • Consumer offset commit happens on ingress/consume path, not dispatch.
  • Failed consume records seek back for in-session retry (transport behavior).
  • Handlers must tolerate redelivery after rebalance or uncommitted offsets.

Non-Goals

  • Does not implement Kafka transactions for consume-process-produce loops.
  • Does not manage topic creation or schema registry.

Public Surface

services.AddLiteBus(litebus =>
{
    litebus.AddKafkaTransport(new KafkaTransportOptions
    {
        BootstrapServers = "localhost:9092",
        ClientId = "orders-inbox-dispatch"
    });

    litebus.AddInbox(inbox =>
    {
        inbox.EnableInboxProcessor();
        inbox.UseKafkaDispatch(
            options =>
            {
                options.DefaultDestination = "orders.commands";
                options.ResolveRoute = envelope => envelope.ContractName;
            });
    });
});
APIRole
InboxModuleBuilder.UseKafkaDispatch(Action<TransportInboxDispatcherOptions>)Registers inbox transport dispatcher that requires the root Kafka transport
TransportInboxDispatcher.DispatchAsync(InboxEnvelope, CancellationToken)Publishes inbox lease payload and headers to Kafka

KafkaTransportOptions:

PropertyDefaultRole
BootstrapServersrequiredKafka bootstrap server list
ClientIdnullProducer and consumer client id
ConsumerGroupIdlitebus-transportGroup id for transport consumer side
MessageTimeoutMsnullProducer local message timeout override
SeekFailureBackoffInitial00:00:00.250Initial seek retry delay
SeekFailureBackoffMax00:00:30Max seek retry delay
SeekFailureBackoffMultiplier2.0Seek retry multiplier

Observability

SignalDetail
send {destination}Tags include topic as messaging.destination.name, record key as messaging.kafka.message.key
litebus.transport.circuit_breaker.*Broker tag kafka
process {destination}Not emitted on dispatch; consumer/ingress path only
litebus.inbox.processor.*Standard inbox processor counters and dispatch duration histogram

Register Kafka transport metrics through AddLiteBusTransportMetrics() from LiteBus.Transport.Extensions.OpenTelemetry.

Deep Docs

Test Coverage

Covered

Test methodProject
InboxDispatchExtensions_ShouldRegisterTransportDispatcherLiteBus.Durable.IntegrationTests (Registration/) (Kafka Theory case)
ProcessPendingAsync_ShouldPublishLeasedEnvelopeToKafkaTopicLiteBus.Durable.IntegrationTests (Dispatch/Inbox/Kafka/)

Untested

  • Inbox dispatch failure on unreachable brokers.
  • Route override and tenant route strategy coverage.
  • Kafka transaction usage, which is not part of current dispatcher contracts.

Out-of-Scope

  • Kafka transactions for consume-process-produce loops
  • Topic creation and schema registry management

On this page