Class: Alephant::Publisher::Publisher
- Inherits:
-
Object
- Object
- Alephant::Publisher::Publisher
- Defined in:
- lib/alephant/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.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/alephant/publisher.rb', line 30 def initialize(opts, processor = nil) @opts = opts @processor = processor @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.
28 29 30 |
# File 'lib/alephant/publisher.rb', line 28 def executor @executor end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
28 29 30 |
# File 'lib/alephant/publisher.rb', line 28 def opts @opts end |
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
28 29 30 |
# File 'lib/alephant/publisher.rb', line 28 def processor @processor end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
28 29 30 |
# File 'lib/alephant/publisher.rb', line 28 def queue @queue end |
Instance Method Details
#run! ⇒ Object
42 43 44 |
# File 'lib/alephant/publisher.rb', line 42 def run! loop { processor.consume(@queue.) } end |