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 Method Summary collapse
-
#ack_id ⇒ Object
The acknowledgment ID for the message.
-
#acknowledge! ⇒ Object
(also: #ack!)
Acknowledges receipt of the message.
-
#attributes ⇒ Object
Optional attributes for the received message.
-
#data ⇒ Object
The received message payload.
-
#delay!(new_deadline) ⇒ Object
(also: #modify_ack_deadline!)
Modifies the acknowledge deadline for the message.
-
#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.
-
#published_at ⇒ Object
(also: #publish_time)
The time at which the message was published.
-
#reject! ⇒ Object
(also: #nack!, #ignore!)
Resets the acknowledge deadline for the message without acknowledging it.
Instance Method Details
#ack_id ⇒ Object
The acknowledgment ID for the message.
57 58 59 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 57 def ack_id @grpc.ack_id end |
#acknowledge! ⇒ Object Also known as: ack!
Acknowledges receipt of the message.
111 112 113 114 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 111 def acknowledge! ensure_subscription! subscription.acknowledge ack_id end |
#attributes ⇒ Object
Optional attributes for the received message.
77 78 79 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 77 def attributes .attributes end |
#data ⇒ Object
The received message payload. This data is a list of bytes encoded as ASCII-8BIT.
71 72 73 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 71 def data .data end |
#delay!(new_deadline) ⇒ Object Also known as: modify_ack_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.
142 143 144 145 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 142 def delay! new_deadline ensure_subscription! subscription.delay new_deadline, ack_id end |
#message ⇒ Object Also known as: msg
The received message.
63 64 65 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 63 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 |
#published_at ⇒ Object Also known as: publish_time
The time at which the message was published.
91 92 93 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 91 def published_at .published_at end |
#reject! ⇒ Object Also known as: nack!, ignore!
Resets the acknowledge deadline for the message without acknowledging it.
This will make the message available for redelivery.
167 168 169 |
# File 'lib/google/cloud/pubsub/received_message.rb', line 167 def reject! delay! 0 end |