Class: GRPC::Kit::Queue::Worker::Runner
- Inherits:
-
Object
- Object
- GRPC::Kit::Queue::Worker::Runner
- Defined in:
- lib/grpc/kit/queue/worker/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Runner
constructor
A new instance of Runner.
- #run! ⇒ Object
Constructor Details
#initialize(params) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 10 |
# File 'lib/grpc/kit/queue/worker/runner.rb', line 6 def initialize(params) @topic_name = params[:topic] @subscription_name = "#{params[:topic]}.#{params[:worker]}" @worker_class = params[:worker] end |
Class Method Details
.run!(params) ⇒ Object
12 13 14 |
# File 'lib/grpc/kit/queue/worker/runner.rb', line 12 def self.run!(params) new(params).run! end |
Instance Method Details
#run! ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/grpc/kit/queue/worker/runner.rb', line 16 def run! if worker.nil? GRPC.logger.error("class #{@worker_class} does not exist") exit end subscription.listen do |msg| worker.new(msg).call end end |