Class: FreeMessageQueue::Message
- Inherits:
-
Object
- Object
- FreeMessageQueue::Message
- Defined in:
- lib/fmq/queues/base.rb
Overview
This is the default message implementation in the queue system
Instance Attribute Summary collapse
-
#content_type ⇒ Object
reference to next Message if there is one.
-
#created_at ⇒ Object
reference to next Message if there is one.
-
#next ⇒ Object
reference to next Message if there is one.
-
#option ⇒ Object
reference to next Message if there is one.
-
#payload ⇒ Object
reference to next Message if there is one.
Instance Method Summary collapse
-
#bytes ⇒ Object
Size of item in bytes.
-
#initialize(payload, content_type = "text/plain", created_at = Time.new) ⇒ Message
constructor
Create a message item.
Constructor Details
#initialize(payload, content_type = "text/plain", created_at = Time.new) ⇒ Message
Create a message item. The payload is often just a string
29 30 31 32 33 34 35 36 37 |
# File 'lib/fmq/queues/base.rb', line 29 def initialize(payload, content_type = "text/plain", created_at = Time.new) @payload = payload @created_at = created_at @content_type = content_type @option = {} if block_given? then yield self end end |
Instance Attribute Details
#content_type ⇒ Object
reference to next Message if there is one
22 23 24 |
# File 'lib/fmq/queues/base.rb', line 22 def content_type @content_type end |
#created_at ⇒ Object
reference to next Message if there is one
22 23 24 |
# File 'lib/fmq/queues/base.rb', line 22 def created_at @created_at end |
#next ⇒ Object
reference to next Message if there is one
22 23 24 |
# File 'lib/fmq/queues/base.rb', line 22 def next @next end |
#option ⇒ Object
reference to next Message if there is one
22 23 24 |
# File 'lib/fmq/queues/base.rb', line 22 def option @option end |
#payload ⇒ Object
reference to next Message if there is one
22 23 24 |
# File 'lib/fmq/queues/base.rb', line 22 def payload @payload end |
Instance Method Details
#bytes ⇒ Object
Size of item in bytes
40 41 42 |
# File 'lib/fmq/queues/base.rb', line 40 def bytes @payload.size end |