Gcloud::Pubsub::ReceivedMessage
ReceivedMessage¶ ↑
Represents a Pub/Sub Message that can be acknowledged or delayed.
require "gcloud" gcloud = Gcloud.new pubsub = gcloud.pubsub sub = pubsub.subscription "my-topic-sub" received_message = sub.pull.first if received_message puts received_message.message.data received_message.acknowledge! end
Parent:
Object
Methods
Public Instance Methods
acknowledge!()
¶
↑
Acknowledges receipt of the message.
Example¶ ↑
require "gcloud" gcloud = Gcloud.new pubsub = gcloud.pubsub sub = pubsub.subscription "my-topic-sub" received_message = sub.pull.first if received_message puts received_message.message.data received_message.acknowledge! end
Also aliased as: ack!
delay!(new_deadline)
¶
↑
Modifies the acknowledge deadline for the message.
This indicates that more time is needed to process the message, or to make the message available for redelivery.
Parameters¶ ↑
deadline
-
The new ack deadline in seconds from the time this request is sent to the Pub/Sub system. Must be >= 0. For example, if the value is
10
, the new ack deadline will expire 10 seconds after the call is made. Specifying0
may immediately make the message available for another pull request. (Integer
)
Example¶ ↑
require "gcloud" gcloud = Gcloud.new pubsub = gcloud.pubsub sub = pubsub.subscription "my-topic-sub" received_message = sub.pull.first if received_message puts received_message.message.data # Delay for 2 minutes received_message.delay! 120 end