Class: Google::Cloud::Pubsub::ReceivedMessage
- Inherits:
-
Object
- Object
- Google::Cloud::Pubsub::ReceivedMessage
- Defined in:
- lib/google/cloud/pubsub/received_message.rb
Overview
# ReceivedMessage
Represents a Pub/Sub Message that can be acknowledged or delayed.
Instance Attribute Summary collapse
Class Method Summary collapse
-
.from_grpc(grpc, subscription) ⇒ Object
Google::Pubsub::V1::ReceivedMessage object.
Instance Method Summary collapse
-
#ack_id ⇒ Object
The acknowledgment ID for the message.
-
#acknowledge! ⇒ Object
(also: #ack!)
Acknowledges receipt of the message.
-
#attributes ⇒ Object
The received message’s attributes.
-
#data ⇒ Object
The received message’s data.
-
#delay!(new_deadline) ⇒ Object
Modifies the acknowledge deadline for the message.
-
#initialize ⇒ ReceivedMessage
constructor
A new instance of ReceivedMessage.
-
#message ⇒ Object
(also: #msg)
The received message.
-
#message_id ⇒ Object
(also: #msg_id)
The ID of the received message, assigned by the server at publication time.
Constructor Details
#initialize ⇒ ReceivedMessage
Returns a new instance of ReceivedMessage.
51 52 53 54 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 51 def initialize @subscription = nil @grpc = Google::Pubsub::V1::ReceivedMessage.new end |
Instance Attribute Details
#grpc ⇒ Object
47 48 49 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 47 def grpc @grpc end |
#subscription ⇒ Object
43 44 45 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 43 def subscription @subscription end |
Class Method Details
.from_grpc(grpc, subscription) ⇒ Object
Google::Pubsub::V1::ReceivedMessage object.
145 146 147 148 149 150 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 145 def self.from_grpc grpc, subscription new.tap do |rm| rm.grpc = grpc rm.subscription = subscription end end |
Instance Method Details
#ack_id ⇒ Object
The acknowledgment ID for the message.
58 59 60 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 58 def ack_id @grpc.ack_id end |
#acknowledge! ⇒ Object Also known as: ack!
Acknowledges receipt of the message.
105 106 107 108 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 105 def acknowledge! ensure_subscription! subscription.acknowledge ack_id end |
#attributes ⇒ Object
The received message’s attributes.
77 78 79 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 77 def attributes .attributes end |
#data ⇒ Object
The received message’s data.
71 72 73 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 71 def data .data end |
#delay!(new_deadline) ⇒ Object
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.
137 138 139 140 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 137 def delay! new_deadline ensure_subscription! subscription.delay new_deadline, ack_id end |
#message ⇒ Object Also known as: msg
The received message.
64 65 66 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 64 def Message.from_grpc @grpc. end |
#message_id ⇒ Object Also known as: msg_id
The ID of the received message, assigned by the server at publication time. Guaranteed to be unique within the topic.
84 85 86 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 84 def . end |