[][src]Struct libzmq::Scatter

pub struct Scatter { /* fields omitted */ }

A Scatter socket is used to pipeline messages to workers.

Messages are round-robined to all connected Gather sockets.

Summary of Characteristics

CharacteristicValue
Compatible peer socketsGather
DirectionUnidirectional
Send/receive patternSend only
Outgoing routing strategyRound-robin
Incoming routing strategyFair-queued
Action in mute stateBlock

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]

impl PartialEq<Scatter> for Scatter[src]

impl Send for Scatter[src]

impl SendMsg for Scatter[src]

impl Socket for Scatter[src]

impl Sync for Scatter[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,