Expand description
gRPC Source Plugin for Drasi
This plugin exposes a gRPC endpoint for receiving data change events. External systems can stream events to Drasi using the gRPC protocol, which provides efficient binary serialization and bidirectional streaming support.
§Service Endpoints
The gRPC source implements the following service methods:
submit_event- Submit a single event (unary RPC)stream_events- Stream multiple events (client streaming RPC)request_bootstrap- Request initial data for bootstrapping (server streaming RPC)health_check- Check service health (unary RPC)
§Protocol Buffer Format
Events are submitted using the SourceChange protobuf message. See the
proto/drasi/v1/source.proto file for the full schema.
§Insert/Update
SourceChange {
type: INSERT or UPDATE
change: Element {
node: Node {
metadata: ElementMetadata { ... }
properties: Struct { ... }
}
}
}§Delete
SourceChange {
type: DELETE
change: Metadata {
reference: ElementReference { ... }
labels: ["Label1", "Label2"]
}
}§Configuration
| Field | Type | Default | Description |
|---|---|---|---|
host | string | "0.0.0.0" | Host address to bind to |
port | u16 | 50051 | Port to listen on |
endpoint | string | None | Optional custom endpoint path |
timeout_ms | u64 | 5000 | Request timeout in milliseconds |
§Example Configuration (YAML)
source_type: grpc
properties:
host: "0.0.0.0"
port: 50051§Usage Example
ⓘ
use drasi_source_grpc::{GrpcSource, GrpcSourceConfig};
use std::sync::Arc;
let config = GrpcSourceConfig {
host: "0.0.0.0".to_string(),
port: 50051,
endpoint: None,
timeout_ms: 5000,
};
let source = Arc::new(GrpcSource::new("my-grpc-source", config)?);
drasi.add_source(source).await?;§Client Example (using grpcurl)
grpcurl -plaintext -d '{"event": {...}}' localhost:50051 drasi.v1.SourceService/SubmitEventRe-exports§
pub use config::GrpcSourceConfig;
Modules§
- config
- Configuration types for gRPC source.
- descriptor
- gRPC source plugin descriptor and configuration DTOs.
- proto
Structs§
- Grpc
Source - gRPC source that exposes a gRPC endpoint to receive SourceChangeEvents.
- Grpc
Source Builder - Builder for gRPC sources.