Class: Google::Cloud::PubSub::PublishResult

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/pubsub/publish_result.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#attributesObject

The message's attributes.



50
51
52
# File 'lib/google/cloud/pubsub/publish_result.rb', line 50

def attributes
  message.attributes
end

#dataObject

The message's data.



44
45
46
# File 'lib/google/cloud/pubsub/publish_result.rb', line 44

def data
  message.data
end

#errorObject

The error that was raised when published, if any.



71
72
73
# File 'lib/google/cloud/pubsub/publish_result.rb', line 71

def error
  @error
end

#failed?Boolean

Whether the publish request failed.

Returns:

  • (Boolean)


82
83
84
# File 'lib/google/cloud/pubsub/publish_result.rb', line 82

def failed?
  !succeeded?
end

#messageObject Also known as: msg

The message.



37
38
39
# File 'lib/google/cloud/pubsub/publish_result.rb', line 37

def message
  @message
end

#message_idObject Also known as: msg_id

The ID of the message, assigned by the server at publication time. Guaranteed to be unique within the topic.



57
58
59
# File 'lib/google/cloud/pubsub/publish_result.rb', line 57

def message_id
  message.message_id
end

#published_atObject Also known as: publish_time

The time at which the message was published.



64
65
66
# File 'lib/google/cloud/pubsub/publish_result.rb', line 64

def published_at
  message.published_at
end

#succeeded?Boolean

Whether the publish request was successful.

Returns:

  • (Boolean)


77
78
79
# File 'lib/google/cloud/pubsub/publish_result.rb', line 77

def succeeded?
  error.nil?
end