Moose Stack

Moose Streaming

Streaming

Viewing:

Overview

The Streaming capability provides standalone real-time data processing with Kafka/Redpanda topics. You can use this capability independently to build event-driven architectures, data transformations, and real-time pipelines without requiring other MooseStack components.

Basic Usage

Stream.ts
import { Stream } from "@514labs/moose-lib";
 
interface ExampleEvent {
  id: string;
  userId: string;
  timestamp: Date;
  eventType: string;
}
 
// Create a standalone stream for events
const exampleStream = new Stream<ExampleEvent>("streaming-topic-name", {
  // Optional: specify destination table
  destination: new OlapTable<ExampleEvent>("table-name")
});
 
// Add consumers for real-time processing
exampleStream.addConsumer((event) => {
  console.log("Processing event:", event);
  // Custom processing logic here
});

Enabling Streaming

To enable streaming, you need to ensure that the streaming_engine feature flag is set to true in your moose.config.toml file:

[features]
streaming_engine = true

Core Capabilities

Streams

Create Streams

Define and create Kafka/Redpanda topics with type-safe schemas
Publishing

Publish Data

Write data to streams from applications, APIs, or external sources
Consuming

Consumer Functions

Read and process data from streams with consumers and processors
Transformation

Streaming Transformations

Process and transform data in-flight between streams

Integration with Other Capabilities

The Streaming capability can be used independently, or in conjunction with other MooseStack modules: