Skip to content

RayforceDB/catalyx-plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Catalyx Plugins

Official plugin collection for Catalyx reactive streaming runtime.

Architecture

Catalyx uses a plugin-first architecture where everything is a reagent:

  • REPL - Interactive shell is a reagent that emits input lines
  • WebSocket - Streaming client emits messages
  • Kafka - Consumer emits records
  • HTTP - Client emits responses

The runtime is script-first - std.ctx defines the standard library including the REPL.

Plugins

Plugin Reagent Types Description
repl repl, stdin Interactive shell - emits user input
websocket ws, websocket WebSocket streaming client
kafka kafka, blink Kafka/Blink message consumer
http http, https HTTP REST client

Installation

Build all plugins

cargo build --release

# Install to user plugins directory
mkdir -p ~/.catalyx/plugins
cp target/release/libcatalyx_*.so ~/.catalyx/plugins/

Usage

REPL - Interactive Shell

The REPL is just another reagent! In std.ctx:

import repl

stdin = reagent(repl)
on stdin(line) => eval(line)

WebSocket - Live Binance Feed

import websocket

btc = reagent(ws, "wss://stream.binance.com:9443/ws/btcusdt@trade")
on btc(msg) => println(msg)

Kafka/Blink

import kafka

events = reagent(kafka, "localhost:9092", "my-topic", 0, 0)
on events(msg) => println(msg)

HTTP

import http

api = reagent(http, "https://api.github.com")
emit api("/users/octocat")
on api(response) => println(response)

Creating Your Own Plugin

Every plugin implements the same interface:

use catalyx_core::{ReagentPlugin, declare_plugin};

#[derive(Default)]
pub struct MyPlugin;

impl ReagentPlugin for MyPlugin {
    fn name(&self) -> &'static str { "myplugin" }
    fn version(&self) -> &'static str { env!("CARGO_PKG_VERSION") }
    fn reagent_types(&self) -> Vec<&'static str> { vec!["mytype"] }
    fn factory(&self, _: &str) -> Option<Box<dyn ReagentPluginFactory>> {
        Some(Box::new(MyFactory))
    }
    fn description(&self) -> &'static str { "My custom plugin" }
}

declare_plugin!(MyPlugin);

Project Structure

catalyx-plugins/
├── Cargo.toml
├── README.md
└── crates/
    ├── repl/        # Interactive REPL plugin
    ├── websocket/   # WebSocket client
    ├── kafka/       # Kafka consumer
    └── http/        # HTTP client

License

MIT

About

Plugins for Catalyx runtime

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages