pub struct PublishKafkaConfig {
pub connector: String,
pub topic: String,
pub key_logic: Option<Template>,
pub value_logic: Option<Template>,
}Expand description
Configuration for the publish_kafka integration function.
The actual Kafka producer is provided by the service layer via AsyncFunctionHandler.
Unknown keys are rejected, as for HttpCallConfig.
Fields§
§connector: StringNamed connector reference
topic: StringTarget topic name
key_logic: Option<Template>JSONLogic expression to compute the message key. Compiled once at
engine construction; read it through
PublishKafkaConfig::resolve_key.
value_logic: Option<Template>JSONLogic expression to compute the message value. Compiled once at
engine construction; read it through
PublishKafkaConfig::resolve_value.
Implementations§
Source§impl PublishKafkaConfig
impl PublishKafkaConfig
Sourcepub fn resolve_key(&self, ctx: &TaskContext<'_>) -> Result<Option<String>>
pub fn resolve_key(&self, ctx: &TaskContext<'_>) -> Result<Option<String>>
Resolve the message key from key_logic. Ok(None) when it is not set —
there is no static key field, so a None key is the caller’s to interpret
(Kafka treats a null key as “partition round-robin”).
Coerced to a plain string, matching HttpCallConfig::resolve_path.
§Errors
Sourcepub fn resolve_value(&self, ctx: &TaskContext<'_>) -> Result<Option<Value>>
pub fn resolve_value(&self, ctx: &TaskContext<'_>) -> Result<Option<Value>>
Resolve the message value from value_logic. Ok(None) when it is not
set — the fallback (typically “serialize the whole message”) stays the
caller’s policy.
Returns Option<Value>, not Option<String>, deliberately: a
producer that does serde_json::to_string unconditionally would put
different bytes on the wire for a string-valued payload than
Self::resolve_key’s plain-string coercion does. Keeping this as a
Value leaves that choice where it belongs.
§Errors
Trait Implementations§
Source§impl Clone for PublishKafkaConfig
impl Clone for PublishKafkaConfig
Source§fn clone(&self) -> PublishKafkaConfig
fn clone(&self) -> PublishKafkaConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more