class Google::Cloud::PubSub::PublishResult
The result of a publish operation. The message object is available on {#message} and will have {#message_id} assigned by the API.
When the publish operation was successful the result will be marked {#succeeded?}. Otherwise, the result will be marked {#failed?} and the error raised will be availabe on {#error}.
Public Class Methods
@private Create an PublishResult
object from a message protobuf and an error.
# File lib/google/cloud/pubsub/publish_result.rb, line 95 def self.from_error msg_grpc, error new Message.from_grpc(msg_grpc), error end
@private Create an PublishResult
object from a message protobuf.
# File lib/google/cloud/pubsub/publish_result.rb, line 88 def self.from_grpc msg_grpc new Message.from_grpc(msg_grpc) end
@private Create an PublishResult
object.
# File lib/google/cloud/pubsub/publish_result.rb, line 30 def initialize message, error = nil @message = message @error = error end
Public Instance Methods
The message's attributes.
# File lib/google/cloud/pubsub/publish_result.rb, line 50 def attributes message.attributes end
The message's data.
# File lib/google/cloud/pubsub/publish_result.rb, line 44 def data message.data end
The error that was raised when published, if any.
# File lib/google/cloud/pubsub/publish_result.rb, line 71 def error @error end
Whether the publish request failed.
# File lib/google/cloud/pubsub/publish_result.rb, line 82 def failed? !succeeded? end
The message.
# File lib/google/cloud/pubsub/publish_result.rb, line 37 def message @message end
The ID of the message, assigned by the server at publication time. Guaranteed to be unique within the topic.
# File lib/google/cloud/pubsub/publish_result.rb, line 57 def message_id message.message_id end
The time at which the message was published.
# File lib/google/cloud/pubsub/publish_result.rb, line 64 def published_at message.published_at end
Whether the publish request was successful.
# File lib/google/cloud/pubsub/publish_result.rb, line 77 def succeeded? error.nil? end