Reference documentation and code samples for the Cloud Pub/Sub V1 API class Google::Cloud::PubSub::V1::Subscriber::Client.
rubocop:disable Style/Documentation
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the Subscriber Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all Subscriber clients ::Google::Cloud::PubSub::V1::Subscriber::Client.configure do |config| config.timeout = 10.0 end
.configure_internal
def self.configure_internal() { |config| ... } -> Client::Configuration
Configure the Subscriber Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all Subscriber clients ::Google::Cloud::PubSub::V1::Subscriber::Client.configure do |config| config.timeout = 10.0 end
#acknowledge
def acknowledge(request, options = nil) -> ::Google::Protobuf::Empty
def acknowledge(subscription: nil, ack_ids: nil) -> ::Google::Protobuf::Empty
Acknowledges the messages associated with the ack_ids
in the
AcknowledgeRequest
. The Pub/Sub system can remove the relevant messages
from the subscription.
Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.
def acknowledge(request, options = nil) -> ::Google::Protobuf::Empty
acknowledge
via a request object, either of type
AcknowledgeRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::AcknowledgeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def acknowledge(subscription: nil, ack_ids: nil) -> ::Google::Protobuf::Empty
acknowledge
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
subscription (::String) — Required. The subscription whose message is being acknowledged.
Format is
projects/{project}/subscriptions/{sub}
. -
ack_ids (::Array<::String>) — Required. The acknowledgment ID for the messages being acknowledged that
was returned by the Pub/Sub system in the
Pull
response. Must not be empty.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::AcknowledgeRequest.new # Call the acknowledge method. result = client.acknowledge request # The returned object is of type Google::Protobuf::Empty. p result
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the Subscriber Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_snapshot
def create_snapshot(request, options = nil) -> ::Google::Cloud::PubSub::V1::Snapshot
def create_snapshot(name: nil, subscription: nil, labels: nil) -> ::Google::Cloud::PubSub::V1::Snapshot
Creates a snapshot from the requested subscription. Snapshots are used in
Seek operations,
which allow you to manage message acknowledgments in bulk. That is, you can
set the acknowledgment state of messages in an existing subscription to the
state captured by a snapshot.
If the snapshot already exists, returns ALREADY_EXISTS
.
If the requested subscription doesn't exist, returns NOT_FOUND
.
If the backlog in the subscription is too old -- and the resulting snapshot
would expire in less than 1 hour -- then FAILED_PRECONDITION
is returned.
See also the Snapshot.expire_time
field. If the name is not provided in
the request, the server will assign a random
name for this snapshot on the same project as the subscription, conforming
to the resource name format. The
generated name is populated in the returned Snapshot object. Note that for
REST API requests, you must specify a name in the request.
def create_snapshot(request, options = nil) -> ::Google::Cloud::PubSub::V1::Snapshot
create_snapshot
via a request object, either of type
CreateSnapshotRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::CreateSnapshotRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_snapshot(name: nil, subscription: nil, labels: nil) -> ::Google::Cloud::PubSub::V1::Snapshot
create_snapshot
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. User-provided name for this snapshot. If the name is not provided
in the request, the server will assign a random name for this snapshot on
the same project as the subscription. Note that for REST API requests, you
must specify a name. See the resource name
rules.
Format is
projects/{project}/snapshots/{snap}
. -
subscription (::String) — Required. The subscription whose backlog the snapshot retains.
Specifically, the created snapshot is guaranteed to retain:
(a) The existing backlog on the subscription. More precisely, this is
defined as the messages in the subscription's backlog that are
unacknowledged upon the successful completion of the
CreateSnapshot
request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format isprojects/{project}/subscriptions/{sub}
. - labels (::Hash{::String => ::String}) — Optional. See Creating and managing labels.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::Snapshot)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::CreateSnapshotRequest.new # Call the create_snapshot method. result = client.create_snapshot request # The returned object is of type Google::Cloud::PubSub::V1::Snapshot. p result
#create_subscription
def create_subscription(request, options = nil) -> ::Google::Cloud::PubSub::V1::Subscription
def create_subscription(name: nil, topic: nil, push_config: nil, bigquery_config: nil, cloud_storage_config: nil, ack_deadline_seconds: nil, retain_acked_messages: nil, message_retention_duration: nil, labels: nil, enable_message_ordering: nil, expiration_policy: nil, filter: nil, dead_letter_policy: nil, retry_policy: nil, detached: nil, enable_exactly_once_delivery: nil) -> ::Google::Cloud::PubSub::V1::Subscription
Creates a subscription to a given topic. See the resource name rules.
If the subscription already exists, returns ALREADY_EXISTS
.
If the corresponding topic doesn't exist, returns NOT_FOUND
.
If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the resource name format. The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.
def create_subscription(request, options = nil) -> ::Google::Cloud::PubSub::V1::Subscription
create_subscription
via a request object, either of type
Google::Cloud::PubSub::V1::Subscription or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::Subscription, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_subscription(name: nil, topic: nil, push_config: nil, bigquery_config: nil, cloud_storage_config: nil, ack_deadline_seconds: nil, retain_acked_messages: nil, message_retention_duration: nil, labels: nil, enable_message_ordering: nil, expiration_policy: nil, filter: nil, dead_letter_policy: nil, retry_policy: nil, detached: nil, enable_exactly_once_delivery: nil) -> ::Google::Cloud::PubSub::V1::Subscription
create_subscription
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The name of the subscription. It must have the format
"projects/{project}/subscriptions/{subscription}"
.{subscription}
must start with a letter, and contain only letters ([A-Za-z]
), numbers ([0-9]
), dashes (-
), underscores (_
), periods (.
), tildes (~
), plus (+
) or percent signs (%
). It must be between 3 and 255 characters in length, and it must not start with"goog"
. -
topic (::String) — Required. The name of the topic from which this subscription is receiving
messages. Format is
projects/{project}/topics/{topic}
. The value of this field will be_deleted-topic_
if the topic has been deleted. - push_config (::Google::Cloud::PubSub::V1::PushConfig, ::Hash) — Optional. If push delivery is used with this subscription, this field is used to configure it.
- bigquery_config (::Google::Cloud::PubSub::V1::BigQueryConfig, ::Hash) — Optional. If delivery to BigQuery is used with this subscription, this field is used to configure it.
- cloud_storage_config (::Google::Cloud::PubSub::V1::CloudStorageConfig, ::Hash) — Optional. If delivery to Google Cloud Storage is used with this subscription, this field is used to configure it.
-
ack_deadline_seconds (::Integer) — Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
waits for the subscriber to acknowledge receipt before resending the
message. In the interval after the message is delivered and before it is
acknowledged, it is considered to be outstanding. During that time
period, the message will not be redelivered (on a best-effort basis).
For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call
ModifyAckDeadline
with the correspondingack_id
if using non-streaming pull or send theack_id
in aStreamingModifyAckDeadlineRequest
if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.For push delivery, this value is also used to set the request timeout for the call to the push endpoint.
If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
-
retain_acked_messages (::Boolean) — Optional. Indicates whether to retain acknowledged messages. If true, then
messages are not expunged from the subscription's backlog, even if they are
acknowledged, until they fall out of the
message_retention_duration
window. This must be true if you would like toSeek
to a timestamp in the past to replay previously-acknowledged messages. -
message_retention_duration (::Google::Protobuf::Duration, ::Hash) — Optional. How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages
is true, then this also configures the retention of acknowledged messages, and thus configures how far back in time aSeek
can be done. Defaults to 7 days. Cannot be more than 31 days or less than 10 minutes. - labels (::Hash{::String => ::String}) — Optional. See Creating and managing labels.
-
enable_message_ordering (::Boolean) — Optional. If true, messages published with the same
ordering_key
inPubsubMessage
will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. -
expiration_policy (::Google::Cloud::PubSub::V1::ExpirationPolicy, ::Hash) — Optional. A policy that specifies the conditions for this subscription's
expiration. A subscription is considered active as long as any connected
subscriber is successfully consuming messages from the subscription or is
issuing operations on the subscription. If
expiration_policy
is not set, a default policy withttl
of 31 days will be used. The minimum allowed value forexpiration_policy.ttl
is 1 day. Ifexpiration_policy
is set, butexpiration_policy.ttl
is not set, the subscription never expires. -
filter (::String) — Optional. An expression written in the Pub/Sub filter
language. If non-empty,
then only
PubsubMessage
s whoseattributes
field matches the filter are delivered on this subscription. If empty, then no messages are filtered out. -
dead_letter_policy (::Google::Cloud::PubSub::V1::DeadLetterPolicy, ::Hash) — Optional. A policy that specifies the conditions for dead lettering
messages in this subscription. If dead_letter_policy is not set, dead
lettering is disabled.
The Pub/Sub service account associated with this subscriptions's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription.
-
retry_policy (::Google::Cloud::PubSub::V1::RetryPolicy, ::Hash) — Optional. A policy that specifies how Pub/Sub retries message delivery for
this subscription.
If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message.
-
detached (::Boolean) — Optional. Indicates whether the subscription is detached from its topic.
Detached subscriptions don't receive messages from their topic and don't
retain any backlog.
Pull
andStreamingPull
requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will not be made. -
enable_exactly_once_delivery (::Boolean) — Optional. If true, Pub/Sub provides the following guarantees for the
delivery of a message with a given value of
message_id
on this subscription:- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinctmessage_id
values.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::Subscription)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::Subscription.new # Call the create_subscription method. result = client.create_subscription request # The returned object is of type Google::Cloud::PubSub::V1::Subscription. p result
#delete_snapshot
def delete_snapshot(request, options = nil) -> ::Google::Protobuf::Empty
def delete_snapshot(snapshot: nil) -> ::Google::Protobuf::Empty
Removes an existing snapshot. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.
def delete_snapshot(request, options = nil) -> ::Google::Protobuf::Empty
delete_snapshot
via a request object, either of type
DeleteSnapshotRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::DeleteSnapshotRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_snapshot(snapshot: nil) -> ::Google::Protobuf::Empty
delete_snapshot
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
snapshot (::String) — Required. The name of the snapshot to delete.
Format is
projects/{project}/snapshots/{snap}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::DeleteSnapshotRequest.new # Call the delete_snapshot method. result = client.delete_snapshot request # The returned object is of type Google::Protobuf::Empty. p result
#delete_subscription
def delete_subscription(request, options = nil) -> ::Google::Protobuf::Empty
def delete_subscription(subscription: nil) -> ::Google::Protobuf::Empty
Deletes an existing subscription. All messages retained in the subscription
are immediately dropped. Calls to Pull
after deletion will return
NOT_FOUND
. After a subscription is deleted, a new one may be created with
the same name, but the new one has no association with the old
subscription or its topic unless the same topic is specified.
def delete_subscription(request, options = nil) -> ::Google::Protobuf::Empty
delete_subscription
via a request object, either of type
DeleteSubscriptionRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::DeleteSubscriptionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_subscription(subscription: nil) -> ::Google::Protobuf::Empty
delete_subscription
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
subscription (::String) — Required. The subscription to delete.
Format is
projects/{project}/subscriptions/{sub}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::DeleteSubscriptionRequest.new # Call the delete_subscription method. result = client.delete_subscription request # The returned object is of type Google::Protobuf::Empty. p result
#get_snapshot
def get_snapshot(request, options = nil) -> ::Google::Cloud::PubSub::V1::Snapshot
def get_snapshot(snapshot: nil) -> ::Google::Cloud::PubSub::V1::Snapshot
Gets the configuration details of a snapshot. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
def get_snapshot(request, options = nil) -> ::Google::Cloud::PubSub::V1::Snapshot
get_snapshot
via a request object, either of type
GetSnapshotRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::GetSnapshotRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_snapshot(snapshot: nil) -> ::Google::Cloud::PubSub::V1::Snapshot
get_snapshot
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
snapshot (::String) — Required. The name of the snapshot to get.
Format is
projects/{project}/snapshots/{snap}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::Snapshot)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::GetSnapshotRequest.new # Call the get_snapshot method. result = client.get_snapshot request # The returned object is of type Google::Cloud::PubSub::V1::Snapshot. p result
#get_subscription
def get_subscription(request, options = nil) -> ::Google::Cloud::PubSub::V1::Subscription
def get_subscription(subscription: nil) -> ::Google::Cloud::PubSub::V1::Subscription
Gets the configuration details of a subscription.
def get_subscription(request, options = nil) -> ::Google::Cloud::PubSub::V1::Subscription
get_subscription
via a request object, either of type
GetSubscriptionRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::GetSubscriptionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_subscription(subscription: nil) -> ::Google::Cloud::PubSub::V1::Subscription
get_subscription
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
subscription (::String) — Required. The name of the subscription to get.
Format is
projects/{project}/subscriptions/{sub}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::Subscription)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::GetSubscriptionRequest.new # Call the get_subscription method. result = client.get_subscription request # The returned object is of type Google::Cloud::PubSub::V1::Subscription. p result
#iam_policy_client
def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client
Get the associated client for mix-in of the IAMPolicy.
- (Google::Iam::V1::IAMPolicy::Client)
#initialize
def initialize() { |config| ... } -> Client
Create a new Subscriber client object.
- (config) — Configure the Subscriber client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a client using a custom configuration client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new do |config| config.timeout = 10.0 end
#list_snapshots
def list_snapshots(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>
def list_snapshots(project: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>
Lists the existing snapshots. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
def list_snapshots(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>
list_snapshots
via a request object, either of type
ListSnapshotsRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::ListSnapshotsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_snapshots(project: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>
list_snapshots
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
project (::String) — Required. The name of the project in which to list snapshots.
Format is
projects/{project-id}
. - page_size (::Integer) — Optional. Maximum number of snapshots to return.
-
page_token (::String) — Optional. The value returned by the last
ListSnapshotsResponse
; indicates that this is a continuation of a priorListSnapshots
call, and that the system should return the next page of data.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::ListSnapshotsRequest.new # Call the list_snapshots method. result = client.list_snapshots request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::PubSub::V1::Snapshot. p item end
#list_subscriptions
def list_subscriptions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>
def list_subscriptions(project: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>
Lists matching subscriptions.
def list_subscriptions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>
list_subscriptions
via a request object, either of type
ListSubscriptionsRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::ListSubscriptionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_subscriptions(project: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>
list_subscriptions
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
project (::String) — Required. The name of the project in which to list subscriptions.
Format is
projects/{project-id}
. - page_size (::Integer) — Optional. Maximum number of subscriptions to return.
-
page_token (::String) — Optional. The value returned by the last
ListSubscriptionsResponse
; indicates that this is a continuation of a priorListSubscriptions
call, and that the system should return the next page of data.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::ListSubscriptionsRequest.new # Call the list_subscriptions method. result = client.list_subscriptions request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::PubSub::V1::Subscription. p item end
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#modify_ack_deadline
def modify_ack_deadline(request, options = nil) -> ::Google::Protobuf::Empty
def modify_ack_deadline(subscription: nil, ack_ids: nil, ack_deadline_seconds: nil) -> ::Google::Protobuf::Empty
Modifies the ack deadline for a specific message. This method is useful
to indicate that more time is needed to process a message by the
subscriber, or to make the message available for redelivery if the
processing was interrupted. Note that this does not modify the
subscription-level ackDeadlineSeconds
used for subsequent messages.
def modify_ack_deadline(request, options = nil) -> ::Google::Protobuf::Empty
modify_ack_deadline
via a request object, either of type
ModifyAckDeadlineRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def modify_ack_deadline(subscription: nil, ack_ids: nil, ack_deadline_seconds: nil) -> ::Google::Protobuf::Empty
modify_ack_deadline
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
subscription (::String) — Required. The name of the subscription.
Format is
projects/{project}/subscriptions/{sub}
. - ack_ids (::Array<::String>) — Required. List of acknowledgment IDs.
-
ack_deadline_seconds (::Integer) — Required. The new ack deadline with respect to the time this request was
sent to the Pub/Sub system. For example, if the value is 10, the new ack
deadline will expire 10 seconds after the
ModifyAckDeadline
call was made. Specifying zero might immediately make the message available for delivery to another subscriber client. This typically results in an increase in the rate of message redeliveries (that is, duplicates). The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify in a single request is 600 seconds (10 minutes).
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest.new # Call the modify_ack_deadline method. result = client.modify_ack_deadline request # The returned object is of type Google::Protobuf::Empty. p result
#modify_push_config
def modify_push_config(request, options = nil) -> ::Google::Protobuf::Empty
def modify_push_config(subscription: nil, push_config: nil) -> ::Google::Protobuf::Empty
Modifies the PushConfig
for a specified subscription.
This may be used to change a push subscription to a pull one (signified by
an empty PushConfig
) or vice versa, or change the endpoint URL and other
attributes of a push subscription. Messages will accumulate for delivery
continuously through the call regardless of changes to the PushConfig
.
def modify_push_config(request, options = nil) -> ::Google::Protobuf::Empty
modify_push_config
via a request object, either of type
ModifyPushConfigRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::ModifyPushConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def modify_push_config(subscription: nil, push_config: nil) -> ::Google::Protobuf::Empty
modify_push_config
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
subscription (::String) — Required. The name of the subscription.
Format is
projects/{project}/subscriptions/{sub}
. -
push_config (::Google::Cloud::PubSub::V1::PushConfig, ::Hash) — Required. The push configuration for future deliveries.
An empty
pushConfig
indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription ifPull
orStreamingPull
is not called.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::ModifyPushConfigRequest.new # Call the modify_push_config method. result = client.modify_push_config request # The returned object is of type Google::Protobuf::Empty. p result
#pull
def pull(request, options = nil) -> ::Google::Cloud::PubSub::V1::PullResponse
def pull(subscription: nil, return_immediately: nil, max_messages: nil) -> ::Google::Cloud::PubSub::V1::PullResponse
Pulls messages from the server.
def pull(request, options = nil) -> ::Google::Cloud::PubSub::V1::PullResponse
pull
via a request object, either of type
PullRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::PullRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def pull(subscription: nil, return_immediately: nil, max_messages: nil) -> ::Google::Cloud::PubSub::V1::PullResponse
pull
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
subscription (::String) — Required. The subscription from which messages should be pulled.
Format is
projects/{project}/subscriptions/{sub}
. -
return_immediately (::Boolean) — Optional. If this field set to true, the system will respond immediately
even if it there are no messages available to return in the
Pull
response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field totrue
is discouraged because it adversely impacts the performance ofPull
operations. We recommend that users do not set this field. - max_messages (::Integer) — Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::PullResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::PullRequest.new # Call the pull method. result = client.pull request # The returned object is of type Google::Cloud::PubSub::V1::PullResponse. p result
#seek
def seek(request, options = nil) -> ::Google::Cloud::PubSub::V1::SeekResponse
def seek(subscription: nil, time: nil, snapshot: nil) -> ::Google::Cloud::PubSub::V1::SeekResponse
Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot must be on the same topic.
def seek(request, options = nil) -> ::Google::Cloud::PubSub::V1::SeekResponse
seek
via a request object, either of type
Google::Cloud::PubSub::V1::SeekRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::SeekRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def seek(subscription: nil, time: nil, snapshot: nil) -> ::Google::Cloud::PubSub::V1::SeekResponse
seek
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- subscription (::String) — Required. The subscription to affect.
-
time (::Google::Protobuf::Timestamp, ::Hash) — Optional. The time to seek to.
Messages retained in the subscription that were published before this
time are marked as acknowledged, and messages retained in the
subscription that were published after this time are marked as
unacknowledged. Note that this operation affects only those messages
retained in the subscription (configured by the combination of
message_retention_duration
andretain_acked_messages
). For example, iftime
corresponds to a point before the message retention window (or to a point before the system's notion of the subscription creation time), only retained messages will be marked as unacknowledged, and already-expunged messages will not be restored. -
snapshot (::String) — Optional. The snapshot to seek to. The snapshot's topic must be the same
as that of the provided subscription. Format is
projects/{project}/snapshots/{snap}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::SeekResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::SeekRequest.new # Call the seek method. result = client.seek request # The returned object is of type Google::Cloud::PubSub::V1::SeekResponse. p result
#streaming_pull
def streaming_pull(request, options = nil) { |response, operation| ... } -> ::Enumerable<::Google::Cloud::PubSub::V1::StreamingPullResponse>
Establishes a stream with the server, which sends messages down to the
client. The client streams acknowledgements and ack deadline modifications
back to the server. The server will close the stream and return the status
on any error. The server may close the stream with status UNAVAILABLE
to
reassign server-side resources, in which case, the client should
re-establish the stream. Flow control can be achieved by configuring the
underlying RPC channel.
- request (::Gapic::StreamInput, ::Enumerable<::Google::Cloud::PubSub::V1::StreamingPullRequest, ::Hash>) — An enumerable of Google::Cloud::PubSub::V1::StreamingPullRequest instances.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
- (response, operation) — Access the result along with the RPC operation
- response (::Enumerable<::Google::Cloud::PubSub::V1::StreamingPullResponse>)
- operation (::GRPC::ActiveCall::Operation)
- (::Enumerable<::Google::Cloud::PubSub::V1::StreamingPullResponse>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create an input stream. input = Gapic::StreamInput.new # Call the streaming_pull method to start streaming. output = client.streaming_pull input # Send requests on the stream. For each request object, set fields by # passing keyword arguments. Be sure to close the stream when done. input << Google::Cloud::PubSub::V1::StreamingPullRequest.new input << Google::Cloud::PubSub::V1::StreamingPullRequest.new input.close # The returned object is a streamed enumerable yielding elements of type # ::Google::Cloud::PubSub::V1::StreamingPullResponse output.each do |current_response| p current_response end
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)
#update_snapshot
def update_snapshot(request, options = nil) -> ::Google::Cloud::PubSub::V1::Snapshot
def update_snapshot(snapshot: nil, update_mask: nil) -> ::Google::Cloud::PubSub::V1::Snapshot
Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
def update_snapshot(request, options = nil) -> ::Google::Cloud::PubSub::V1::Snapshot
update_snapshot
via a request object, either of type
UpdateSnapshotRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::UpdateSnapshotRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_snapshot(snapshot: nil, update_mask: nil) -> ::Google::Cloud::PubSub::V1::Snapshot
update_snapshot
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- snapshot (::Google::Cloud::PubSub::V1::Snapshot, ::Hash) — Required. The updated snapshot object.
- update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. Indicates which fields in the provided snapshot to update. Must be specified and non-empty.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::Snapshot)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::UpdateSnapshotRequest.new # Call the update_snapshot method. result = client.update_snapshot request # The returned object is of type Google::Cloud::PubSub::V1::Snapshot. p result
#update_subscription
def update_subscription(request, options = nil) -> ::Google::Cloud::PubSub::V1::Subscription
def update_subscription(subscription: nil, update_mask: nil) -> ::Google::Cloud::PubSub::V1::Subscription
Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.
def update_subscription(request, options = nil) -> ::Google::Cloud::PubSub::V1::Subscription
update_subscription
via a request object, either of type
UpdateSubscriptionRequest or an equivalent Hash.
- request (::Google::Cloud::PubSub::V1::UpdateSubscriptionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_subscription(subscription: nil, update_mask: nil) -> ::Google::Cloud::PubSub::V1::Subscription
update_subscription
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- subscription (::Google::Cloud::PubSub::V1::Subscription, ::Hash) — Required. The updated subscription object.
- update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. Indicates which fields in the provided subscription to update. Must be specified and non-empty.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::PubSub::V1::Subscription)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/pubsub/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::PubSub::V1::Subscriber::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::PubSub::V1::UpdateSubscriptionRequest.new # Call the update_subscription method. result = client.update_subscription request # The returned object is of type Google::Cloud::PubSub::V1::Subscription. p result