Class: MessageQueue::Producer
- Inherits:
-
Object
- Object
- MessageQueue::Producer
- Includes:
- OptionsHelper
- Defined in:
- lib/message_queue/producer.rb
Direct Known Subclasses
Adapters::Bunny::Connection::Producer, Adapters::Memory::Connection::Producer
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #default_options ⇒ Object
- #dump_object(object) ⇒ Object
-
#initialize(connection, options = {}) ⇒ Producer
constructor
A new instance of Producer.
Methods included from OptionsHelper
Constructor Details
#initialize(connection, options = {}) ⇒ Producer
Returns a new instance of Producer.
10 11 12 13 |
# File 'lib/message_queue/producer.rb', line 10 def initialize(connection, = {}) @connection = connection = deep_clone() end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
8 9 10 |
# File 'lib/message_queue/producer.rb', line 8 def connection @connection end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/message_queue/producer.rb', line 8 def end |
Instance Method Details
#default_options ⇒ Object
19 20 21 |
# File 'lib/message_queue/producer.rb', line 19 def { :content_type => connection.serializer.content_type, :timestamp => Time.now.utc.to_i, :message_id => generate_id } end |
#dump_object(object) ⇒ Object
15 16 17 |
# File 'lib/message_queue/producer.rb', line 15 def dump_object(object) connection.serializer.dump(object) end |