pub struct BasePublisherBuilder { /* private fields */ }Expand description
A builder for BasePublisher.
§Example
let builder = BasePublisher::builder();
let client = builder
.with_endpoint("https://pubsub.googleapis.com")
.build()
.await?;Implementations§
Source§impl BasePublisherBuilder
impl BasePublisherBuilder
Sourcepub async fn build(self) -> BuilderResult<BasePublisher>
pub async fn build(self) -> BuilderResult<BasePublisher>
Sourcepub fn with_endpoint<V: Into<String>>(self, v: V) -> Self
pub fn with_endpoint<V: Into<String>>(self, v: V) -> Self
Sets the endpoint.
§Example
let client = BasePublisher::builder()
.with_endpoint("https://private.googleapis.com")
.build()
.await?;Sourcepub fn with_tracing(self) -> Self
pub fn with_tracing(self) -> Self
Sourcepub fn with_credentials<V: Into<Credentials>>(self, v: V) -> Self
pub fn with_credentials<V: Into<Credentials>>(self, v: V) -> Self
Configure the authentication credentials.
Most Google Cloud services require authentication, though some services allow for anonymous access, and some services provide emulators where no authentication is required. More information about valid credentials types can be found in the google-cloud-auth crate documentation.
§Example
use google_cloud_auth::credentials::mds;
let client = BasePublisher::builder()
.with_credentials(
mds::Builder::default()
.with_scopes(["https://www.googleapis.com/auth/cloud-platform.read-only"])
.build()?)
.build()
.await?;Sourcepub fn with_retry_policy<V: Into<RetryPolicyArg>>(self, v: V) -> Self
pub fn with_retry_policy<V: Into<RetryPolicyArg>>(self, v: V) -> Self
Configure the retry policy.
The client libraries can automatically retry operations that fail. The retry policy controls what errors are considered retryable, sets limits on the number of attempts or the time trying to make attempts.
§Example
use google_cloud_gax::retry_policy::RetryPolicyExt;
use google_cloud_pubsub::retry_policy::RetryableErrors;
let client = BasePublisher::builder()
.with_retry_policy(RetryableErrors.with_attempt_limit(3))
.build()
.await?;Sourcepub fn with_backoff_policy<V: Into<BackoffPolicyArg>>(self, v: V) -> Self
pub fn with_backoff_policy<V: Into<BackoffPolicyArg>>(self, v: V) -> Self
Configure the retry backoff policy.
The client libraries can automatically retry operations that fail. The backoff policy controls how long to wait in between retry attempts.
§Example
use google_cloud_gax::exponential_backoff::ExponentialBackoff;
use std::time::Duration;
let policy = ExponentialBackoff::default();
let client = BasePublisher::builder()
.with_backoff_policy(policy)
.build()
.await?;Sourcepub fn with_retry_throttler<V: Into<RetryThrottlerArg>>(self, v: V) -> Self
pub fn with_retry_throttler<V: Into<RetryThrottlerArg>>(self, v: V) -> Self
Configure the retry throttler.
Advanced applications may want to configure a retry throttler to Address Cascading Failures and when Handling Overload conditions. The client libraries throttle their retry loop, using a policy to control the throttling algorithm. Use this method to fine tune or customize the default retry throttler.
§Example
use google_cloud_gax::retry_throttler::AdaptiveThrottler;
let client = BasePublisher::builder()
.with_retry_throttler(AdaptiveThrottler::default())
.build()
.await?;Sourcepub fn with_grpc_subchannel_count(self, v: usize) -> Self
pub fn with_grpc_subchannel_count(self, v: usize) -> Self
Configure the number of gRPC subchannels.
§Example
let client = BasePublisher::builder()
.with_grpc_subchannel_count(4)
.build()
.await?;gRPC-based clients may exhibit high latency if many requests need to be demuxed over a single HTTP/2 connection (often called a subchannel in gRPC).
Consider using more subchannels if your application makes many concurrent requests. Consider using fewer subchannels if your application needs the file descriptors for other purposes.
Trait Implementations§
Source§impl Clone for BasePublisherBuilder
impl Clone for BasePublisherBuilder
Source§fn clone(&self) -> BasePublisherBuilder
fn clone(&self) -> BasePublisherBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BasePublisherBuilder
impl !RefUnwindSafe for BasePublisherBuilder
impl Send for BasePublisherBuilder
impl Sync for BasePublisherBuilder
impl Unpin for BasePublisherBuilder
impl UnsafeUnpin for BasePublisherBuilder
impl !UnwindSafe for BasePublisherBuilder
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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