Skip to content

Ripple SDK

Vinod Sathyaseelan edited this page Aug 15, 2025 · 2 revisions

Ripple SDK

Overview

The Ripple SDK provides tools and libraries for developing services and integrating with the Ripple Firebolt Gateway. It enables developers to create custom functionality using internal RPC calls and service brokers.

Core Components

Service Controller

The ServiceController manages the lifecycle and communication of services:

use ripple_sdk::service::{ServiceController, ServiceConfig};

pub struct MyService {
    controller: ServiceController
}

impl MyService {
    pub fn new(config: ServiceConfig) -> Self {
        Self {
            controller: ServiceController::new(config)
        }
    }
}

Service Registry

Handles service discovery and registration:

use ripple_sdk::service::{ServiceRegistry, ServiceInfo};

// Register a new service
registry.register(ServiceInfo {
    name: "my_service",
    version: "1.0",
    methods: vec!["method1", "method2"]
});

Service Client

Enables communication between services:

use ripple_sdk::service::ServiceClient;

// Create a client to interact with other services
let client = ServiceClient::connect("other_service").await?;
let response = client.call("method_name", params).await?;

Service Communication

Services communicate using internal RPC calls through brokers:

Request/Response Pattern

// Service implementation
async fn handle_request(&self, method: &str, params: Value) -> Result<Value> {
    match method {
        "get_data" => {
            // Handle the request
            Ok(json!({ "data": "response" }))
        }
        _ => Err(Error::MethodNotFound)
    }
}

Event Broadcasting

// Broadcast events to subscribers
controller.broadcast_event("status_changed", payload).await?;

Service Brokers

Brokers handle communication routing between services:

  • WebSocket Broker: For web-based services
  • HTTP Broker: RESTful service communication
  • Internal Broker: Direct in-process communication

Best Practices

  1. Use strongly-typed message structures
  2. Implement proper error handling
  3. Follow the service lifecycle patterns
  4. Document API endpoints
  5. Handle service discovery gracefully

API Reference

See our API Documentation for:

  • Service interfaces
  • RPC protocol details
  • Broker configurations
  • Message formats

Examples

Check our examples directory for:

  • Basic service setup
  • RPC communication
  • Broker configuration
  • Event handling

Clone this wiki locally