pub struct NatsProducer { /* private fields */ }Expand description
Publishes JSON tasks with a dedicated inbox for each response.
Explicit task models override the configured default. Sending fails if
neither exists. Receiving waits for the first inbox message and decodes it
as a Response; no built-in response timeout or NATS-status handling is
provided. Use Task::send_and_wait with a timeout to bound the reply wait.
Implementations§
Source§impl NatsProducer
impl NatsProducer
Sourcepub async fn from_env_or_default() -> Result<Self>
pub async fn from_env_or_default() -> Result<Self>
Connects using OPENAI_API_NATS_URL (default nats://localhost:4222).
Snapshots OPENAI_API_NATS_PREFIX (default openai-api-queue/) and the
optional OPENAI_API_DEFAULT_MODEL. Connection errors are returned.
Trait Implementations§
Source§impl Clone for NatsProducer
impl Clone for NatsProducer
Source§fn clone(&self) -> NatsProducer
fn clone(&self) -> NatsProducer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NatsProducer
impl Debug for NatsProducer
Source§impl QueueProducer for NatsProducer
impl QueueProducer for NatsProducer
Auto Trait Implementations§
impl !RefUnwindSafe for NatsProducer
impl !UnwindSafe for NatsProducer
impl Freeze for NatsProducer
impl Send for NatsProducer
impl Sync for NatsProducer
impl Unpin for NatsProducer
impl UnsafeUnpin for NatsProducer
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