pub struct GrpcSource { /* private fields */ }Expand description
gRPC source that exposes a gRPC endpoint to receive SourceChangeEvents.
This source implements a gRPC service for receiving data change events from external systems. It supports both unary and streaming RPC methods for event submission.
§Fields
base: Common source functionality (dispatchers, status, lifecycle)config: gRPC-specific configuration (host, port, timeout)
Implementations§
Source§impl GrpcSource
impl GrpcSource
Sourcepub fn builder(id: impl Into<String>) -> GrpcSourceBuilder
pub fn builder(id: impl Into<String>) -> GrpcSourceBuilder
Sourcepub fn new(id: impl Into<String>, config: GrpcSourceConfig) -> Result<Self>
pub fn new(id: impl Into<String>, config: GrpcSourceConfig) -> Result<Self>
Create a new gRPC source.
The event channel is automatically injected when the source is added
to DrasiLib via add_source().
§Arguments
id- Unique identifier for this source instanceconfig- gRPC source configuration
§Returns
A new GrpcSource instance, or an error if construction fails.
§Errors
Returns an error if the base source cannot be initialized.
§Example
ⓘ
use drasi_source_grpc::{GrpcSource, GrpcSourceConfig};
let config = GrpcSourceConfig {
host: "0.0.0.0".to_string(),
port: 50051,
endpoint: None,
timeout_ms: 5000,
};
let source = GrpcSource::new("my-grpc-source", config)?;Sourcepub fn with_dispatch(
id: impl Into<String>,
config: GrpcSourceConfig,
dispatch_mode: Option<DispatchMode>,
dispatch_buffer_capacity: Option<usize>,
) -> Result<Self>
pub fn with_dispatch( id: impl Into<String>, config: GrpcSourceConfig, dispatch_mode: Option<DispatchMode>, dispatch_buffer_capacity: Option<usize>, ) -> Result<Self>
Create a new gRPC source with custom dispatch settings
The event channel is automatically injected when the source is added
to DrasiLib via add_source().
Trait Implementations§
Source§impl Source for GrpcSource
impl Source for GrpcSource
Source§fn properties(&self) -> HashMap<String, Value>
fn properties(&self) -> HashMap<String, Value>
Get the source’s configuration properties for inspection Read more
Source§fn auto_start(&self) -> bool
fn auto_start(&self) -> bool
Whether this source should auto-start when DrasiLib starts Read more
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the source Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop the source Read more
Source§fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ComponentStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ComponentStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the current status of the source
Source§fn subscribe<'life0, 'async_trait>(
&'life0 self,
settings: SourceSubscriptionSettings,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe<'life0, 'async_trait>(
&'life0 self,
settings: SourceSubscriptionSettings,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Subscribe to this source for change events Read more
Source§fn initialize<'life0, 'async_trait>(
&'life0 self,
context: SourceRuntimeContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
context: SourceRuntimeContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the source with runtime context. Read more
Source§fn set_bootstrap_provider<'life0, 'async_trait>(
&'life0 self,
provider: Box<dyn BootstrapProvider + 'static>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_bootstrap_provider<'life0, 'async_trait>(
&'life0 self,
provider: Box<dyn BootstrapProvider + 'static>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the bootstrap provider for this source Read more
Source§fn dispatch_mode(&self) -> DispatchMode
fn dispatch_mode(&self) -> DispatchMode
Get the dispatch mode for this source (Channel or Broadcast) Read more
Source§fn supports_replay(&self) -> bool
fn supports_replay(&self) -> bool
Whether this source supports positional replay via
resume_from. Read moreAuto Trait Implementations§
impl Freeze for GrpcSource
impl !RefUnwindSafe for GrpcSource
impl Send for GrpcSource
impl Sync for GrpcSource
impl Unpin for GrpcSource
impl UnsafeUnpin for GrpcSource
impl !UnwindSafe for GrpcSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request