Class: Propono::QueueListener
- Inherits:
-
Object
- Object
- Propono::QueueListener
- Defined in:
- lib/propono/services/queue_listener.rb
Instance Attribute Summary collapse
-
#aws_client ⇒ Object
readonly
Returns the value of attribute aws_client.
-
#message_processor ⇒ Object
readonly
Returns the value of attribute message_processor.
-
#propono_config ⇒ Object
readonly
Returns the value of attribute propono_config.
-
#topic_name ⇒ Object
readonly
Returns the value of attribute topic_name.
-
#visibility_timeout ⇒ Object
readonly
Returns the value of attribute visibility_timeout.
Class Method Summary collapse
Instance Method Summary collapse
- #drain ⇒ Object
-
#initialize(aws_client, propono_config, topic_name, options = {}, &message_processor) ⇒ QueueListener
constructor
A new instance of QueueListener.
- #listen ⇒ Object
Constructor Details
#initialize(aws_client, propono_config, topic_name, options = {}, &message_processor) ⇒ QueueListener
Returns a new instance of QueueListener.
13 14 15 16 17 18 19 |
# File 'lib/propono/services/queue_listener.rb', line 13 def initialize(aws_client, propono_config, topic_name, = {}, &) @aws_client = aws_client @propono_config = propono_config @topic_name = topic_name = @visibility_timeout = [:visibility_timeout] || nil end |
Instance Attribute Details
#aws_client ⇒ Object (readonly)
Returns the value of attribute aws_client.
12 13 14 |
# File 'lib/propono/services/queue_listener.rb', line 12 def aws_client @aws_client end |
#message_processor ⇒ Object (readonly)
Returns the value of attribute message_processor.
12 13 14 |
# File 'lib/propono/services/queue_listener.rb', line 12 def end |
#propono_config ⇒ Object (readonly)
Returns the value of attribute propono_config.
12 13 14 |
# File 'lib/propono/services/queue_listener.rb', line 12 def propono_config @propono_config end |
#topic_name ⇒ Object (readonly)
Returns the value of attribute topic_name.
12 13 14 |
# File 'lib/propono/services/queue_listener.rb', line 12 def topic_name @topic_name end |
#visibility_timeout ⇒ Object (readonly)
Returns the value of attribute visibility_timeout.
12 13 14 |
# File 'lib/propono/services/queue_listener.rb', line 12 def visibility_timeout @visibility_timeout end |
Class Method Details
.drain(*args, &message_processor) ⇒ Object
8 9 10 |
# File 'lib/propono/services/queue_listener.rb', line 8 def self.drain(*args, &) new(*args, &).drain end |
.listen(*args, &message_processor) ⇒ Object
4 5 6 |
# File 'lib/propono/services/queue_listener.rb', line 4 def self.listen(*args, &) new(*args, &).listen end |
Instance Method Details
#drain ⇒ Object
28 29 30 31 32 |
# File 'lib/propono/services/queue_listener.rb', line 28 def drain raise ProponoError.new("topic_name is nil") unless topic_name true while (main_queue, 10, long_poll: false) true while (slow_queue, 10, long_poll: false) if propono_config.slow_queue_enabled end |
#listen ⇒ Object
21 22 23 24 25 26 |
# File 'lib/propono/services/queue_listener.rb', line 21 def listen raise ProponoError.new("topic_name is nil") unless topic_name loop do end end |