pub struct NatsOutputConfig {
pub connection_config: ConnectOptions,
pub subject: String,
pub headers: Vec<NatsHeader>,
pub message_id: NatsMessageId,
pub publish_timeout: Option<ConfigDuration>,
pub max_message_size: Option<usize>,
}Expand description
Configuration for writing data to a NATS subject with nats_output.
The connector publishes to JetStream: each message is published with an acknowledgment request and the publish is retried until the server acknowledges it or the pipeline shuts down, so data is not lost to a server that is momentarily unavailable. The subject must be bound to a JetStream stream; publishing to a subject with no stream raises “no responders” and the publish fails.
Fields§
§connection_config: ConnectOptionsOptions for connecting to the NATS server.
subject: StringNATS subject to publish to (e.g., “orders.created”). The subject must be bound to a JetStream stream on the target server.
headers: Vec<NatsHeader>Headers to add to every message published by this connector, as key/value pairs. Values are UTF-8 strings.
message_id: NatsMessageIdHow the Nats-Msg-Id header of each message is chosen. Within a
stream’s duplicate window (the stream’s duplicate_window), the
server discards a publish whose id it has already stored, which makes
output replayed after a restart idempotent. Default: content_hash.
publish_timeout: Option<ConfigDuration>How long to wait for the server’s publish acknowledgment before
retrying the publish, for example 5s. Must be at least one second.
Unset selects the default, DEFAULT_PUBLISH_TIMEOUT.
max_message_size: Option<usize>Override for the maximum message size in bytes the connector offers to
the encoder. When unset, the connector discovers the limit at connect
time: the bound stream’s max_message_size when the stream sets one,
else the server’s max payload. The encoder splits output records across
messages by this limit; a record larger than the limit fails the
pipeline with an error naming the record rather than reaching the
server.
Implementations§
Source§impl NatsOutputConfig
impl NatsOutputConfig
Sourcepub fn publish_timeout(&self) -> ConfigDuration
pub fn publish_timeout(&self) -> ConfigDuration
The publish timeout in effect, or DEFAULT_PUBLISH_TIMEOUT.
Trait Implementations§
Source§impl Clone for NatsOutputConfig
impl Clone for NatsOutputConfig
Source§impl Debug for NatsOutputConfig
impl Debug for NatsOutputConfig
Source§impl<'de> Deserialize<'de> for NatsOutputConfig
impl<'de> Deserialize<'de> for NatsOutputConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for NatsOutputConfig
Source§impl PartialEq for NatsOutputConfig
impl PartialEq for NatsOutputConfig
Source§impl Serialize for NatsOutputConfig
impl Serialize for NatsOutputConfig
impl StructuralPartialEq for NatsOutputConfig
Auto Trait Implementations§
impl Freeze for NatsOutputConfig
impl RefUnwindSafe for NatsOutputConfig
impl Send for NatsOutputConfig
impl Sync for NatsOutputConfig
impl Unpin for NatsOutputConfig
impl UnsafeUnpin for NatsOutputConfig
impl UnwindSafe for NatsOutputConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.