Class: Kymera::Broker
- Inherits:
-
Object
- Object
- Kymera::Broker
- Defined in:
- lib/kymera/broker.rb
Instance Method Summary collapse
-
#initialize ⇒ Broker
constructor
A new instance of Broker.
-
#start_broker ⇒ Object
This brings up the broker so that it can receive test run requests.
Constructor Details
#initialize ⇒ Broker
Returns a new instance of Broker.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kymera/broker.rb', line 8 def initialize config = Kymera::Config.new @zmq = Kymera::SZMQ.new Thread.abort_on_exception = true #This will change once I get the worker registry up and running. When that is up, there will be one connection spawned for #each of the workers that are connected. Edit - Thats actually not sustainable. The number of workers should be able to change #dynamically without impact to the broker. An inventory check should be made at the start of every new test run. There should also # be some logic to handle the disconnection of workers in the middle of a test run. @num_of_connections = config.broker["number_of_connections"] #This socket is for getting tests from the client @client_address = "tcp://*:#{config.broker["client_listening_port"]}" @internal_address = "tcp://*:#{config.broker["internal_worker_port"]}" @worker_address = "tcp://*:#{config.broker["worker_listening_port"]}" @test_socket = @zmq.socket(@client_address, 'pull') @test_socket.bind @front_end = @zmq.socket(@internal_address, 'router') @back_end = @zmq.socket(@worker_address, 'dealer') @proxy = Thread.new {@zmq.start_proxy(@front_end, @back_end)} @results = '' end |
Instance Method Details
#start_broker ⇒ Object
This brings up the broker so that it can receive test run requests.
30 31 32 33 34 35 36 |
# File 'lib/kymera/broker.rb', line 30 def start_broker puts "Broker started..." @test_socket.receive do |tests| puts "Received test run request.." start_test_run(tests) end end |