[−][src]Struct libzmq::Scatter
A Scatter
socket is used to pipeline messages to workers.
Messages are round-robined to all connected Gather
sockets.
Summary of Characteristics
Characteristic | Value |
---|---|
Compatible peer sockets | Gather |
Direction | Unidirectional |
Send/receive pattern | Send only |
Outgoing routing strategy | Round-robin |
Incoming routing strategy | Fair-queued |
Action in mute state | Block |
Example
use libzmq::{prelude::*, *}; use std::time::Duration; let addr = InprocAddr::new_unique(); // Our load balancing producer. let lb = ScatterBuilder::new() .bind(&addr) .build()?; let worker_a = GatherBuilder::new() .connect(&addr) .recv_hwm(1) .recv_timeout(Duration::from_millis(100)) .build()?; let worker_b = GatherBuilder::new() .connect(&addr) .recv_hwm(1) .recv_timeout(Duration::from_millis(100)) .build()?; // Send messages to workers in a round-robin fashion. lb.send("")?; lb.send("")?; assert!(worker_a.recv_msg()?.is_empty()); assert!(worker_b.recv_msg()?.is_empty());
Implementations
impl Scatter
[src]
pub fn new() -> Result<Self, Error>
[src]
pub fn with_ctx(handle: CtxHandle) -> Result<Self, Error>
[src]
Create a Scatter
socket associated with a specific context
from a CtxHandle
.
Returned Error Variants
pub fn ctx(&self) -> CtxHandle
[src]
Returns a handle to the context of the socket.
Trait Implementations
impl Clone for Scatter
[src]
impl Debug for Scatter
[src]
impl Eq for Scatter
[src]
impl<'a> From<&'a Scatter> for Pollable<'a>
[src]
impl Heartbeating for Scatter
[src]
fn heartbeat(&self) -> Option<Heartbeat>
[src]
fn set_heartbeat(&self, maybe: Option<Heartbeat>) -> Result<(), Error>
[src]
impl PartialEq<Scatter> for Scatter
[src]
impl Send for Scatter
[src]
impl SendMsg for Scatter
[src]
fn send<M>(&self, msg: M) -> Result<(), Error<Msg>> where
M: Into<Msg>,
[src]
M: Into<Msg>,
fn try_send<M>(&self, msg: M) -> Result<(), Error<Msg>> where
M: Into<Msg>,
[src]
M: Into<Msg>,
fn send_hwm(&self) -> Result<i32, Error>
[src]
fn set_send_hwm(&self, hwm: i32) -> Result<(), Error>
[src]
fn send_timeout(&self) -> Result<Period, Error>
[src]
fn set_send_timeout<P>(&self, period: P) -> Result<(), Error> where
P: Into<Period>,
[src]
P: Into<Period>,
impl Socket for Scatter
[src]
fn connect<E>(&self, endpoint: E) -> Result<(), Error> where
E: Into<Endpoint>,
[src]
E: Into<Endpoint>,
fn bind<E>(&self, endpoint: E) -> Result<(), Error> where
E: Into<Endpoint>,
[src]
E: Into<Endpoint>,
fn disconnect<E>(&self, endpoint: E) -> Result<(), Error> where
E: Into<Endpoint>,
[src]
E: Into<Endpoint>,
fn unbind<I, E>(&self, endpoint: E) -> Result<(), Error> where
E: Into<Endpoint>,
[src]
E: Into<Endpoint>,
fn last_endpoint(&self) -> Result<Endpoint, Error>
[src]
fn mechanism(&self) -> Mechanism
[src]
fn set_mechanism<M>(&self, mechanism: M) -> Result<(), Error> where
M: Into<Mechanism>,
[src]
M: Into<Mechanism>,
impl Sync for Scatter
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,