pub struct SubscriptionManager { /* private fields */ }Expand description
Subscription manager for managing Pub/Sub subscriptions.
Uses the google-cloud-pubsub 0.33 SubscriptionAdmin client for
subscription management and tracks subscriptions in a local cache.
Implementations§
Source§impl SubscriptionManager
impl SubscriptionManager
Sourcepub async fn new(project_id: impl Into<String>) -> Result<Self>
pub async fn new(project_id: impl Into<String>) -> Result<Self>
Creates a new subscription manager.
Sourcepub async fn create_subscription(
&self,
config: SubscriptionCreateConfig,
) -> Result<String>
pub async fn create_subscription( &self, config: SubscriptionCreateConfig, ) -> Result<String>
Creates a new subscription.
Sourcepub fn get_subscription(&self, subscription_name: &str) -> Option<String>
pub fn get_subscription(&self, subscription_name: &str) -> Option<String>
Gets a fully-qualified subscription name by short name.
Sourcepub async fn delete_subscription(&self, subscription_name: &str) -> Result<()>
pub async fn delete_subscription(&self, subscription_name: &str) -> Result<()>
Deletes a subscription.
Sourcepub fn list_subscriptions(&self) -> Vec<String>
pub fn list_subscriptions(&self) -> Vec<String>
Lists all subscriptions.
Sourcepub fn subscription_exists(&self, subscription_name: &str) -> bool
pub fn subscription_exists(&self, subscription_name: &str) -> bool
Checks if a subscription exists.
Sourcepub fn subscription_count(&self) -> usize
pub fn subscription_count(&self) -> usize
Gets the number of managed subscriptions.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clears all cached subscriptions.
Sourcepub fn project_id(&self) -> &str
pub fn project_id(&self) -> &str
Gets the project ID.
Sourcepub async fn update_ack_deadline(
&self,
subscription_name: &str,
_ack_deadline_seconds: i64,
) -> Result<()>
pub async fn update_ack_deadline( &self, subscription_name: &str, _ack_deadline_seconds: i64, ) -> Result<()>
Updates subscription acknowledgment deadline.
Sourcepub async fn update_labels(
&self,
subscription_name: &str,
_labels: HashMap<String, String>,
) -> Result<()>
pub async fn update_labels( &self, subscription_name: &str, _labels: HashMap<String, String>, ) -> Result<()>
Updates subscription labels.
Sourcepub async fn get_metadata(
&self,
subscription_name: &str,
) -> Result<SubscriptionMetadata>
pub async fn get_metadata( &self, subscription_name: &str, ) -> Result<SubscriptionMetadata>
Gets subscription metadata.
Sourcepub async fn get_stats(
&self,
subscription_name: &str,
) -> Result<SubscriptionStats>
pub async fn get_stats( &self, subscription_name: &str, ) -> Result<SubscriptionStats>
Gets subscription statistics.
Auto Trait Implementations§
impl Freeze for SubscriptionManager
impl !RefUnwindSafe for SubscriptionManager
impl Send for SubscriptionManager
impl Sync for SubscriptionManager
impl Unpin for SubscriptionManager
impl UnsafeUnpin for SubscriptionManager
impl !UnwindSafe for SubscriptionManager
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