pub struct StreamingPull { /* private fields */ }Expand description
Builder for the client::Subscriber::streaming_pull method.
Implementations§
Source§impl StreamingPull
impl StreamingPull
Sourcepub fn start(self) -> Session
pub fn start(self) -> Session
Creates a new session to receive messages from the subscription.
Note that the underlying connection with the server is lazy-initialized.
It is not established until Session::next() is called.
§Example
let mut session = client
.streaming_pull("projects/my-project/subscriptions/my-subscription")
.start();
while let Some((m, h)) = session.next().await.transpose()? {
println!("Received message m={m:?}");
h.ack();
}Sourcepub fn set_ack_deadline_seconds<T: Into<i32>>(self, v: T) -> Self
pub fn set_ack_deadline_seconds<T: Into<i32>>(self, v: T) -> Self
Sets the ack deadline to use for the stream.
This value represents how long the application has to ack or nack an incoming message. Note that this value is independent of the deadline configured on the server-side subscription.
If the server does not hear back from the client within this deadline (e.g. if an application crashes), it will resend any unacknowledged messages to another subscriber.
The minimum deadline you can specify is 10 seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
The default value is 10 seconds.
§Example
let session = client.streaming_pull("projects/my-project/subscriptions/my-subscription")
.set_ack_deadline_seconds(20)
.start();Sourcepub fn set_max_outstanding_messages<T: Into<i64>>(self, v: T) -> Self
pub fn set_max_outstanding_messages<T: Into<i64>>(self, v: T) -> Self
Flow control settings for the maximum number of outstanding messages.
The server will stop sending messages to a client when this many messages are outstanding (i.e. that have not been acked or nacked).
The server resumes sending messages when the outstanding message count drops below this value.
Use a value <= 0 to set no limit on the number of outstanding messages.
The default value is 1000 messages.
§Example
let session = client.streaming_pull("projects/my-project/subscriptions/my-subscription")
.set_max_outstanding_messages(2000)
.start();Sourcepub fn set_max_outstanding_bytes<T: Into<i64>>(self, v: T) -> Self
pub fn set_max_outstanding_bytes<T: Into<i64>>(self, v: T) -> Self
Flow control settings for the maximum number of outstanding bytes.
The server will stop sending messages to a client when this many bytes of messages are outstanding (i.e. that have not been acked or nacked).
The server resumes sending messages when the outstanding byte count drops below this value.
Use a value <= 0 to set no limit on the number of outstanding bytes.
The default value is 100 MiB.
§Example
# use google_cloud_pubsub::client::Subscriber;
# async fn sample() -> anyhow::Result<()> {
# let client = Subscriber::builder().build().await?;
const MIB: i64 = 1024 * 1024;
let session = client.streaming_pull("projects/my-project/subscriptions/my-subscription")
.set_max_outstanding_bytes(200 * MIB)
.start();
# Ok(()) }Auto Trait Implementations§
impl Freeze for StreamingPull
impl !RefUnwindSafe for StreamingPull
impl Send for StreamingPull
impl Sync for StreamingPull
impl Unpin for StreamingPull
impl !UnwindSafe for StreamingPull
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
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