Skip to content
GuidesDocs 1.3.x

Choose an Event Adapter

Every Connectum EventBus uses the same EventAdapter contract. Choose a broker from workload and operational requirements, then keep broker-specific tuning in that adapter's generated API reference.

Broker Selection Matrix

AdapterPersistenceConsumer coordinationOrdering scopeBest starting fit
MemoryNoNonePublish callUnit tests and local prototypes
NATS JetStreamYesDurable consumersSubjectLightweight, low-latency service events
Kafka / RedpandaYesNative consumer groupsPartitionHigh-throughput streams and retained logs
Redis Streams / ValkeyConfigurable by RedisConsumer groupsStreamTeams already operating Redis-compatible infrastructure
AMQP / RabbitMQ / LavinMQDurable queues/exchanges when configuredCompeting consumersQueueRouting topologies and external AMQP contracts

All production adapters implement at-least-once delivery semantics. Handlers must be idempotent and acknowledge only after their side effects are complete. Broker configuration determines actual durability and retention.

Memory

MemoryAdapter() ships with @connectum/events. It has no external dependency, persistence, or consumer groups and is intended for tests and local development.

typescript
import { MemoryAdapter } from '@connectum/events';

const adapter = MemoryAdapter();

NATS JetStream

Choose NATS for durable subjects, wildcard routing, and a compact operational footprint.

typescript
import { NatsAdapter } from '@connectum/events-nats';

const adapter = NatsAdapter({ servers: 'nats://localhost:4222' });

Kafka or Redpanda

Choose Kafka-compatible infrastructure for partitioned ordering, retained logs, and high-throughput stream processing.

typescript
import { KafkaAdapter } from '@connectum/events-kafka';

const adapter = KafkaAdapter({
  brokers: ['localhost:9092'],
  clientId: 'orders-service',
});

Redis Streams or Valkey

Choose Redis Streams when the team already operates Redis-compatible infrastructure and needs stream consumer groups without a separate broker stack.

typescript
import { RedisAdapter } from '@connectum/events-redis';

const adapter = RedisAdapter({ url: 'redis://localhost:6379' });

AMQP or RabbitMQ

Choose AMQP for exchange/queue topology, competing consumers, or integration with an externally governed AMQP contract.

typescript
import { AmqpAdapter } from '@connectum/events-amqp';

const adapter = AmqpAdapter({
  url: 'amqp://localhost:5672',
  exchange: 'events',
  exchangeType: 'topic',
});

Automatic Client Identification

When an adapter-specific client or connection name is not supplied, the EventBus derives a service identifier from registered proto service names and the host. An explicit adapter option always wins. Use explicit names when broker ACLs, dashboards, or support procedures depend on stable identifiers.

Custom Adapters

Implement the generated EventAdapter contract when a broker is not covered. Keep serialization, connection lifecycle, subscription cancellation, acknowledgement behavior, and error semantics explicit.

Next Steps