Back to Services
Events

Stream

Events flowing between services without tight coupling.

What is Stream?

Stream connects services via events—order placed, user signed up, file uploaded. Services publish events and subscribe to topics, without knowing who's listening or producing.

Stream provides pub/sub messaging with ordering guarantees, exactly-once delivery semantics, replay capability, and consumer groups. Events are schema-validated, indexed, and routable by topic or pattern. It integrates with Worker for async processing, Hooks for external delivery, and Ledger for durable storage.

Key Features

  • Pub/sub messaging
  • Exactly-once delivery
  • Ordered event streams
  • Consumer groups
  • Event replay capability
  • Schema validation
  • Topic-based routing
  • Backpressure handling

Common Use Cases

How teams use Stream to build better systems

Event-Driven Architecture

Connect services through events without tight coupling or direct dependencies

Real-Time Processing

Process events as they happen for instant reactions and updates

Service Decoupling

Allow services to communicate without knowing about each other directly

Data Synchronization

Keep multiple services and databases in sync through event propagation

Activity Feeds

Build real-time activity streams and notification feeds from events

Analytics Pipeline

Stream events to analytics systems for real-time insights and processing

Production-Ready

High-Performance Event Streaming

Built for real-time event processing at scale

1M+
Events per second
Exactly-Once
Delivery guarantee
<10ms
End-to-end latency
100%
Ordered delivery

Quick Start

Get started with Stream using our official SDKs

import { Fourbyfour } from '@fourbyfour/sdk';

const client = new Fourbyfour({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});

// Create a topic
await client.stream.topics.create({
  name: 'order.placed',
  partitions: 3
});

// Publish an event
await client.stream.topics.produce('order.placed', {
  key: 'order-123',
  value: { orderId: '123', total: 99.99 }
});

// Consume events
const { records } = await client.stream.topics.consume('order.placed', {
  group: 'checkout-service'
});

Install the SDK: npm install @fourbyfour/sdk

How It Works

Understanding Stream's workflow

1

Event Publication

Publishers send events to topics with automatic schema validation and batching for efficiency. Events are assigned sequence numbers for ordering guarantees.

2

Topic Routing

Events are routed to topic partitions based on keys, ensuring ordered delivery per partition. Pattern matching allows wildcard subscriptions across multiple topics.

3

Consumer Distribution

Consumer groups enable load balancing across multiple subscribers. Each consumer in a group receives a subset of partitions, with automatic rebalancing on failures.

4

Delivery Confirmation

Consumers acknowledge event processing with offset commits. Exactly-once semantics prevent duplicate processing even during failures or rebalancing.

Ready to use Stream?

Add Stream to your project and build event-driven systems