Class: Dronejob::Server
- Inherits:
-
Object
- Object
- Dronejob::Server
- Defined in:
- lib/dronejob/server.rb
Instance Attribute Summary collapse
-
#max_threads ⇒ Object
readonly
Returns the value of attribute max_threads.
-
#min_threads ⇒ Object
readonly
Returns the value of attribute min_threads.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#worker ⇒ Object
readonly
Returns the value of attribute worker.
Instance Method Summary collapse
-
#initialize(options) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(options) ⇒ Server
Returns a new instance of Server.
5 6 7 8 9 |
# File 'lib/dronejob/server.rb', line 5 def initialize() @queue = .dronejob_queue || "drone" @min_threads = .min_threads || 1 @max_threads = .max_threads || 1 end |
Instance Attribute Details
#max_threads ⇒ Object (readonly)
Returns the value of attribute max_threads.
3 4 5 |
# File 'lib/dronejob/server.rb', line 3 def max_threads @max_threads end |
#min_threads ⇒ Object (readonly)
Returns the value of attribute min_threads.
3 4 5 |
# File 'lib/dronejob/server.rb', line 3 def min_threads @min_threads end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
3 4 5 |
# File 'lib/dronejob/server.rb', line 3 def queue @queue end |
#worker ⇒ Object (readonly)
Returns the value of attribute worker.
3 4 5 |
# File 'lib/dronejob/server.rb', line 3 def worker @worker end |
Instance Method Details
#start ⇒ Object
11 12 13 14 15 |
# File 'lib/dronejob/server.rb', line 11 def start @worker = ActiveJob::GoogleCloudPubsub::Worker.new(queue: @queue, pubsub: Dronejob::Base.pubsub, min_threads: self.min_threads, max_threads: self.max_threads) Dronejob::Base.log("info", "Starting server for queue #{@queue} ...", nil) @worker.run end |