pub struct ConnectorLink {
pub url: ConnectorUrl,
pub config: Vec<(String, String)>,
pub serializer: Option<SerializerFn>,
pub consumer_factory: Option<ConsumerFactoryFn>,
}Expand description
Configuration for a connector link
Stores the parsed URL and configuration until the record is built. The actual client creation and handler spawning happens during the build phase.
Fields§
§url: ConnectorUrlParsed connector URL
config: Vec<(String, String)>Additional configuration options (protocol-specific)
serializer: Option<SerializerFn>Serialization callback that converts record values to bytes for publishing
This is a type-erased function that takes &dyn Any and returns Result<Vec<u8>, String>.
The connector implementation will downcast to the concrete type and call the serializer.
If None, the connector must provide a default serialization mechanism or fail.
Available in both std and no_std (with alloc feature) environments.
consumer_factory: Option<ConsumerFactoryFn>Consumer factory callback (alloc feature)
Creates ConsumerTrait from Arc<AimDb
Mirrors the producer_factory pattern used for inbound connectors.
Available in both std and no_std + alloc environments.
Implementations§
Source§impl ConnectorLink
impl ConnectorLink
Sourcepub fn new(url: ConnectorUrl) -> Self
pub fn new(url: ConnectorUrl) -> Self
Creates a new connector link from a URL
Sourcepub fn with_config(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_config( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Adds a configuration option
Sourcepub fn create_consumer(
&self,
db_any: Arc<dyn Any + Send + Sync>,
) -> Option<Box<dyn ConsumerTrait>>
pub fn create_consumer( &self, db_any: Arc<dyn Any + Send + Sync>, ) -> Option<Box<dyn ConsumerTrait>>
Creates a consumer using the stored factory (alloc feature)
Takes an Arc
Returns None if no factory is configured.
Available in both std and no_std + alloc environments.
Trait Implementations§
Source§impl Clone for ConnectorLink
impl Clone for ConnectorLink
Source§fn clone(&self) -> ConnectorLink
fn clone(&self) -> ConnectorLink
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more