pub struct PubSubSubscription { /* private fields */ }Expand description
A subscription descriptor for one Pub/Sub subscription.
Implements SubscriptionSource, so it can sit inline in the #[subscriber(..)]
decorator:
use std::time::Duration;
use ruststream_gcp_pubsub::PubSubSubscription;
let source = PubSubSubscription::new("orders-workers")
.max_outstanding(1_000)
.ack_extension(Duration::from_secs(60));Implementations§
Source§impl PubSubSubscription
impl PubSubSubscription
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Names an existing subscription (short name or full
projects/{p}/subscriptions/{s} resource name).
Sourcepub fn create_with_topic(self, topic: impl Into<String>) -> Self
pub fn create_with_topic(self, topic: impl Into<String>) -> Self
Creates the subscription bound to topic on subscribe when it does not exist yet (the
topic is created too). Meant for local development and tests against the emulator;
production subscriptions are usually managed as infrastructure.
Sourcepub fn max_outstanding(self, messages: i64) -> Self
pub fn max_outstanding(self, messages: i64) -> Self
Flow control: how many received messages may be outstanding (unacked) at once. Defaults to the client’s 1000.
Sourcepub fn ack_extension(self, extension: Duration) -> Self
pub fn ack_extension(self, extension: Duration) -> Self
How far each background ack-deadline extension reaches while a handler runs. The client clamps it to the protocol’s 10s..=600s range; defaults to 60s.
Sourcepub fn subscription(&self) -> &str
pub fn subscription(&self) -> &str
The subscription name this descriptor resolves.
Trait Implementations§
Source§impl Clone for PubSubSubscription
impl Clone for PubSubSubscription
Source§fn clone(&self) -> PubSubSubscription
fn clone(&self) -> PubSubSubscription
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PubSubSubscription
impl Debug for PubSubSubscription
impl Eq for PubSubSubscription
Source§impl PartialEq for PubSubSubscription
impl PartialEq for PubSubSubscription
impl StructuralPartialEq for PubSubSubscription
Source§impl SubscriptionSource<ConnectedPubSubBroker> for PubSubSubscription
impl SubscriptionSource<ConnectedPubSubBroker> for PubSubSubscription
Source§type Subscriber = PubSubSubscriber
type Subscriber = PubSubSubscriber
Source§async fn subscribe(
self,
connected: &ConnectedPubSubBroker,
) -> Result<PubSubSubscriber, PubSubError>
async fn subscribe( self, connected: &ConnectedPubSubBroker, ) -> Result<PubSubSubscriber, PubSubError>
Auto Trait Implementations§
impl Freeze for PubSubSubscription
impl RefUnwindSafe for PubSubSubscription
impl Send for PubSubSubscription
impl Sync for PubSubSubscription
impl Unpin for PubSubSubscription
impl UnsafeUnpin for PubSubSubscription
impl UnwindSafe for PubSubSubscription
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
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
T in a tonic::Request