pub struct ZmqQueuePublish;Expand description
The publish policy for ZmqQueuePublisher.
§Examples
A handler that splits each order into picks and pushes them to the pickers’ queue, bound at the mount site:
use std::error::Error;
use ruststream_zeromq::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
struct Order {
id: u64,
lines: Vec<u64>,
}
#[derive(Serialize, Outgoing)]
#[outgoing(name = "picks")]
struct Pick {
order: u64,
item: u64,
}
#[subscriber("orders")]
async fn split(
order: &Order,
Out(picks): Out<impl Publisher>,
) -> Result<(), Box<dyn Error + Send + Sync>> {
for &item in &order.lines {
picks.message(&Pick { order: order.id, item }).publish().await?;
}
Ok(())
}
#[ruststream::app]
fn app() -> impl App {
let pickers = ZmqQueue::new(ZmqEndpoint::connect("tcp://pickers:5556")).bindable();
let to_pickers = pickers.bind(ZmqQueuePublish);
RustStream::new(AppInfo::new("splitter", "0.1.0"))
.with_broker(ZmqQueue::new(ZmqEndpoint::bind("tcp://0.0.0.0:5555")), |b| {
b.include(split).out(DefaultSlot, to_pickers).build();
})
.register_broker(pickers)
}Trait Implementations§
Source§impl Clone for ZmqQueuePublish
impl Clone for ZmqQueuePublish
impl Copy for ZmqQueuePublish
Source§impl Debug for ZmqQueuePublish
impl Debug for ZmqQueuePublish
Source§impl Default for ZmqQueuePublish
impl Default for ZmqQueuePublish
Source§impl<Role: EndpointRole> PublishPolicy<ConnectedZmqQueue<Role>> for ZmqQueuePublish
impl<Role: EndpointRole> PublishPolicy<ConnectedZmqQueue<Role>> for ZmqQueuePublish
Source§fn pair(
self,
connected: &ConnectedZmqQueue<Role>,
) -> impl Future<Output = Result<Self::Live, PairError>>
fn pair( self, connected: &ConnectedZmqQueue<Role>, ) -> impl Future<Output = Result<Self::Live, PairError>>
Source§fn channel_bindings(&self, channel: &str) -> Bindings
fn channel_bindings(&self, channel: &str) -> Bindings
The destination reaches the binding, because on this pattern it is also what frame 0 of every message on the channel holds.
Source§type Live = ZmqQueuePublisher
type Live = ZmqQueuePublisher
The live form this policy pairs into: a
Publisher for a leaf policy, or the live
wiring form for a combinator stack (a typed publisher over a policy pairs into the same
typed publisher over the live leaf).Source§fn operation_bindings(&self, channel: &str) -> Bindings
fn operation_bindings(&self, channel: &str) -> Bindings
What a publish through this policy adds to its
send operation in the document. Read moreAuto Trait Implementations§
impl Freeze for ZmqQueuePublish
impl RefUnwindSafe for ZmqQueuePublish
impl Send for ZmqQueuePublish
impl Sync for ZmqQueuePublish
impl Unpin for ZmqQueuePublish
impl UnsafeUnpin for ZmqQueuePublish
impl UnwindSafe for ZmqQueuePublish
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more