Class: Alephant::Publisher::Queue::Publisher
- Inherits:
-
Object
- Object
- Alephant::Publisher::Queue::Publisher
- Includes:
- Logger
- Defined in:
- lib/alephant/publisher/queue/publisher.rb
Constant Summary collapse
- VISIBILITY_TIMEOUT =
60
- RECEIVE_WAIT_TIME =
15
Instance Attribute Summary collapse
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
-
#initialize(opts, processor = nil) ⇒ Publisher
constructor
A new instance of Publisher.
- #run! ⇒ Object
Constructor Details
#initialize(opts, processor = nil) ⇒ Publisher
Returns a new instance of Publisher.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/alephant/publisher/queue/publisher.rb', line 12 def initialize(opts, processor = nil) @opts = opts @processor = processor @queue = Alephant::Publisher::Queue::SQSHelper::Queue.new( aws_queue, archiver, opts.queue[:visibility_timeout] || VISIBILITY_TIMEOUT, opts.queue[:receive_wait_time] || RECEIVE_WAIT_TIME ) end |
Instance Attribute Details
#executor ⇒ Object (readonly)
Returns the value of attribute executor.
10 11 12 |
# File 'lib/alephant/publisher/queue/publisher.rb', line 10 def executor @executor end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
10 11 12 |
# File 'lib/alephant/publisher/queue/publisher.rb', line 10 def opts @opts end |
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
10 11 12 |
# File 'lib/alephant/publisher/queue/publisher.rb', line 10 def processor @processor end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
10 11 12 |
# File 'lib/alephant/publisher/queue/publisher.rb', line 10 def queue @queue end |
Instance Method Details
#run! ⇒ Object
24 25 26 |
# File 'lib/alephant/publisher/queue/publisher.rb', line 24 def run! loop { processor.consume(@queue.) } end |