Class: Shoryuken::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/shoryuken/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, queue, data) ⇒ Message

Returns a new instance of Message.


5
6
7
8
9
10
# File 'lib/shoryuken/message.rb', line 5

def initialize(client, queue, data)
  self.client     = client
  self.data       = data
  self.queue_url  = queue.url
  self.queue_name = queue.name
end

Instance Attribute Details

#clientObject

Returns the value of attribute client


3
4
5
# File 'lib/shoryuken/message.rb', line 3

def client
  @client
end

#dataObject

Returns the value of attribute data


3
4
5
# File 'lib/shoryuken/message.rb', line 3

def data
  @data
end

#queue_nameObject

Returns the value of attribute queue_name


3
4
5
# File 'lib/shoryuken/message.rb', line 3

def queue_name
  @queue_name
end

#queue_urlObject

Returns the value of attribute queue_url


3
4
5
# File 'lib/shoryuken/message.rb', line 3

def queue_url
  @queue_url
end

Instance Method Details

#attributesObject


49
50
51
# File 'lib/shoryuken/message.rb', line 49

def attributes
  data.attributes
end

#bodyObject


45
46
47
# File 'lib/shoryuken/message.rb', line 45

def body
  data.body
end

#change_visibility(options) ⇒ Object


19
20
21
22
23
# File 'lib/shoryuken/message.rb', line 19

def change_visibility(options)
  client.change_message_visibility(
    options.merge(queue_url: queue_url, receipt_handle: data.receipt_handle)
  )
end

#deleteObject


12
13
14
15
16
17
# File 'lib/shoryuken/message.rb', line 12

def delete
  client.delete_message(
    queue_url: queue_url,
    receipt_handle: data.receipt_handle
  )
end

#md5_of_bodyObject


41
42
43
# File 'lib/shoryuken/message.rb', line 41

def md5_of_body
  data.md5_of_body
end

#md5_of_message_attributesObject


53
54
55
# File 'lib/shoryuken/message.rb', line 53

def md5_of_message_attributes
  data.md5_of_message_attributes
end

#message_attributesObject


57
58
59
# File 'lib/shoryuken/message.rb', line 57

def message_attributes
  data.message_attributes
end

#message_idObject


33
34
35
# File 'lib/shoryuken/message.rb', line 33

def message_id
  data.message_id
end

#receipt_handleObject


37
38
39
# File 'lib/shoryuken/message.rb', line 37

def receipt_handle
  data.receipt_handle
end

#visibility_timeout=(timeout) ⇒ Object


25
26
27
28
29
30
31
# File 'lib/shoryuken/message.rb', line 25

def visibility_timeout=(timeout)
  client.change_message_visibility(
    queue_url: queue_url,
    receipt_handle: data.receipt_handle,
    visibility_timeout: timeout
  )
end