Skip to main content

Crate synapse_sdk

Crate synapse_sdk 

Source
Expand description

Synapse SDK for building services

Provides high-level abstractions for:

  • Making RPC calls to other services through the gateway
  • Implementing service handlers
  • Service registration and lifecycle

§Axum Integration

To embed Synapse RPC into an existing axum application:

use axum::{Router, routing::post};
use synapse_sdk::{axum::synapse_rpc_handler, axum::SynapseState, Service};

let service = Service::builder("my-service").build();
let state = SynapseState::new(service.rpc_server().clone());

let app = Router::new()
    .route("/my-endpoints", get(my_handler))
    .route("/rpc", post(synapse_rpc_handler))
    .with_state(state);

Re-exports§

pub use axum::SynapseState;
pub use axum::synapse_rpc_handler;
pub use client::SynClient;
pub use http_server::HealthProvider;
pub use http_server::HttpRpcServer;
pub use middleware::Middleware;
pub use middleware::MiddlewareChain;
pub use middleware::RequestState;
pub use service::HealthCheckFn;
pub use service::HealthStatus;
pub use service::HttpRouteConfig;
pub use service::HttpRouteGroup;
pub use service::Service;
pub use service::ServiceBuilder;

Modules§

axum
Axum integration for Synapse RPC
client
Unified RPC client with connection pooling
http_server
HTTP/HTTPS server for service RPC endpoints
middleware
Middleware system for service handlers
service
Service development helpers

Structs§

HttpRoute
HttpRpcClient
HTTP RPC client
InstanceId
Instance identifier - represents a specific running instance of a service
InterfaceId
Interface identifier - represents a protobuf-defined RPC interface
InterfaceRegistration
Registration info for an interface
MethodId
Method identifier - represents a method within an RPC interface
RouteOptions
RpcError
RpcRequest
RpcResponse

Enums§

ContentType
Content type indicator for serialization format
HttpMethod
RpcStatus