pub struct SubscribeOpts {
pub subscription_name: Option<String>,
pub topic_key_filter: Option<String>,
pub mode: SubscriptionMode,
pub consumer_group: Option<GroupOpts>,
}Expand description
Options for subscribing to a topic.
§Examples
Ephemeral stream with partition filter (see keyed_topic example):
use photon_backend::SubscribeOpts;
let opts = SubscribeOpts::default_ephemeral().topic_key_filter("alice");Durable broadcast by subscription name:
use photon_backend::SubscribeOpts;
let opts = SubscribeOpts::broadcast().subscription_name("my-worker");Fields§
§subscription_name: Option<String>Subscription name (required for durable broadcast mode).
topic_key_filter: Option<String>Filter by topic key (for keyed topics).
mode: SubscriptionModeDurable or ephemeral mode.
consumer_group: Option<GroupOpts>Consumer group (load-balanced); mutually exclusive with durable subscription name.
Implementations§
Source§impl SubscribeOpts
impl SubscribeOpts
Sourcepub const fn default_ephemeral() -> Self
pub const fn default_ephemeral() -> Self
Create default options (ephemeral, no key filter).
Sourcepub fn consumer_group(self, opts: GroupOpts) -> Self
pub fn consumer_group(self, opts: GroupOpts) -> Self
Load-balanced consumer group subscription.
Sourcepub fn subscription_name(self, name: impl Into<String>) -> Self
pub fn subscription_name(self, name: impl Into<String>) -> Self
Set subscription name (for durable mode).
Sourcepub fn topic_key_filter(self, key: impl Into<String>) -> Self
pub fn topic_key_filter(self, key: impl Into<String>) -> Self
Set topic key filter.
Sourcepub const fn mode(self, mode: SubscriptionMode) -> Self
pub const fn mode(self, mode: SubscriptionMode) -> Self
Set mode.
Trait Implementations§
Source§impl Clone for SubscribeOpts
impl Clone for SubscribeOpts
Source§fn clone(&self) -> SubscribeOpts
fn clone(&self) -> SubscribeOpts
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 SubscribeOpts
impl Debug for SubscribeOpts
Source§impl Default for SubscribeOpts
impl Default for SubscribeOpts
Source§fn default() -> SubscribeOpts
fn default() -> SubscribeOpts
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SubscribeOpts
impl RefUnwindSafe for SubscribeOpts
impl Send for SubscribeOpts
impl Sync for SubscribeOpts
impl Unpin for SubscribeOpts
impl UnsafeUnpin for SubscribeOpts
impl UnwindSafe for SubscribeOpts
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