Module: Wukong::EventMachineDriver

Includes:
DriverMethods
Included in:
Local::StdioDriver, Local::TCPDriver
Defined in:
lib/wukong/local/event_machine_driver.rb

Overview

A module which can be included by other drivers which lets them use EventMachine under the hood.

Instance Attribute Summary

Attributes included from DriverMethods

#dataflow, #settings

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DriverMethods

#add_serialization, #build_serializer, #construct_dataflow, #driver, #finalize_and_stop_dataflow, #finalize_dataflow, #lookup, #lookup_and_build, #setup_dataflow

Class Method Details

.included(klass) ⇒ Object

:nodoc:



10
11
12
13
14
15
16
17
# File 'lib/wukong/local/event_machine_driver.rb', line 10

def self.included klass
  klass.class_eval do
    def self.add_signal_traps
      Signal.trap('INT')  { log.info 'Received SIGINT. Stopping.'  ; EM.stop }
      Signal.trap('TERM') { log.info 'Received SIGTERM. Stopping.' ; EM.stop }                  
    end
  end
end

Instance Method Details

#initialize(label, settings) ⇒ Object

:nodoc:



20
21
22
23
24
# File 'lib/wukong/local/event_machine_driver.rb', line 20

def initialize(label, settings)
  super
  @settings = settings      
  @dataflow = construct_dataflow(label, settings)
end