Skip to main content

Events

Events let you build event-driven architecture between your services through a unified interface. Declare a broker (the connection to your message provider), define topics on it, then produce and consume from anywhere in your stack.

SDK naming

The events API is exposed as ductape.events in the SDK.

Quick example

import Ductape from '@ductape/sdk';

const ductape = new Ductape({ accessKey: 'your-access-key' });

// Produce
await ductape.events.produce({
event: 'order-events:order-created',
message: { orderId: '123', total: 99.99 },
});

// Consume
await ductape.events.consume({
event: 'order-events:order-created',
callback: async (message) => {
await processOrder(message);
},
});

Events use the format brokerTag:topicTag. Everything before the colon identifies the broker; everything after identifies the topic within it.

Three concepts

ConceptWhat it is
BrokerA connection configuration for one message provider (credentials + per-env settings). Brokers have no topics built in — topics are added separately.
TopicA named event stream within a broker. One broker supports unlimited topics; each is created via events.topics.create.
EventA message produced to or consumed from a topic. Always referenced as brokerTag:topicTag.

Supported providers

ProviderType constantBest for
KafkaKAFKAHigh-throughput distributed streaming
RabbitMQRABBITMQFlexible routing, reliable delivery
RedisREDISSimple pub/sub, low latency
AWS SQSAWS_SQSServerless managed queues
Azure Service BusAZURE_SERVICE_BUSAzure managed messaging
Google Pub/SubGOOGLE_PUBSUBGCP integration
NATSNATSLightweight, high-performance messaging

Next steps