pub struct SubjectSubscribers {
pub fanout: Sender<Arc<EventEnvelope>>,
pub groups: HashMap<String, Vec<QueueGroupMember>>,
}Expand description
Pre-partitioned subscribers for a single subject.
Fanout uses a broadcast channel: one send() delivers to all
receivers without per-subscriber cloning — the Arc is cloned internally.
Queue groups keep per-member mpsc channels for round-robin selection.
Fields§
§fanout: Sender<Arc<EventEnvelope>>Broadcast channel for fanout delivery.
groups: HashMap<String, Vec<QueueGroupMember>>Queue groups: one member per group receives each message.
Implementations§
Source§impl SubjectSubscribers
impl SubjectSubscribers
pub fn new(capacity: usize) -> Self
Sourcepub fn subscribe_fanout(&self) -> Receiver<Arc<EventEnvelope>>
pub fn subscribe_fanout(&self) -> Receiver<Arc<EventEnvelope>>
Create a new fanout receiver from the broadcast channel.
Sourcepub fn add_to_groups(
&mut self,
member: QueueGroupMember,
queue_groups: &[String],
)
pub fn add_to_groups( &mut self, member: QueueGroupMember, queue_groups: &[String], )
Add a member to one or more queue groups.
Sourcepub fn remove_from_groups(&mut self, id: SubscriptionId)
pub fn remove_from_groups(&mut self, id: SubscriptionId)
Remove a member by id from all queue groups.
Auto Trait Implementations§
impl Freeze for SubjectSubscribers
impl !RefUnwindSafe for SubjectSubscribers
impl Send for SubjectSubscribers
impl Sync for SubjectSubscribers
impl Unpin for SubjectSubscribers
impl UnsafeUnpin for SubjectSubscribers
impl !UnwindSafe for SubjectSubscribers
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request