Skip to content
CommunicationDocs 1.3.x

Events ​

An order was accepted. Inventory or another subscriber may need to react, but Orders does not need their answer to this publication. The EventBus connects typed protobuf events to consuming handlers through an adapter.

Publish, consume, recover and drain events A typed publication resolves its topic and passes through the chosen adapter to matching consuming middleware and a handler, with dead letters, AMQP recovery and shutdown relay as separate reliability concerns. EXHAUSTED STOPPING Publish eventTyped protobufAwait adapter outcome Resolve topicOverride, then declarationsElse schema.typeNamestrictTopics can reject Event adapterMemory / NATSKafka / Redis / AMQPConnect / disconnect SubscriptionmatchExact or wildcardNo route: ack + skip Consume middlewareCustom → DLQ → retryRetries re-enter handler Event handlerSide effects, then ackIdempotent on redelivery Dead-letter topicCopy after retry exhaustionAcknowledge after publicationPublish failure can lose event AMQPrecoveryReconnect + replayRestore consumersObserve terminal loss ShutdownrelayIn-flight ctx.publishDrain + abort graceThen disconnect
Publishing skips consuming middleware. Local retries re-enter the handler; exhausted failures can produce a DLQ copy, whose publication can also fail. Shutdown relay uses in-flight ctx.publish before the handler returns. Recovery and relay details marked Since 1.3.0 require that release.

One publication ​

Given a generated OrderCreatedSchema and a started eventBus:

typescript
import { create } from '@bufbuild/protobuf';

await eventBus.publish(
  OrderCreatedSchema,
  create(OrderCreatedSchema, { orderId: 'order-42' }),
);

The adapter determines publication confirmation and delivery behavior. Subscribers must account for failures and repeated deliveries; publishing does not create a distributed transaction.

Go deeper ​

Features marked Since 1.3.0 in the detailed guides require that package at 1.3.0 or later.

Find a section from the full guide

The detailed material is preserved on a separate page. Earlier section links still work here.