Class: Clients::DataStreamEvents
- Inherits:
-
P2::DataStream
- Object
- P2::DataStream
- Clients::DataStreamEvents
- Defined in:
- lib/clients/order_console.rb
Instance Method Summary collapse
-
#initialize(conn, short_name) ⇒ DataStreamEvents
constructor
A new instance of DataStreamEvents.
- #onStreamDataBegin(stream) ⇒ Object
- #onStreamDataDeleted(stream, table_name, id, rec) ⇒ Object
- #onStreamDataEnd(stream) ⇒ Object
- #onStreamDataInserted(stream, table_name, rec) ⇒ Object
- #onStreamDataUpdated(stream, table_name, id, rec) ⇒ Object
- #onStreamDatumDeleted(stream, table_name, rev) ⇒ Object
- #onStreamDBWillBeDeleted(stream) ⇒ Object
- #onStreamLifeNumChanged(stream, life_num) ⇒ Object
-
#onStreamStateChanged(stream, new_state) ⇒ Object
Define Handlers for IP2DataStreamEvents event interface.
- #wrap(rec) ⇒ Object
Constructor Details
#initialize(conn, short_name) ⇒ DataStreamEvents
Returns a new instance of DataStreamEvents.
27 28 29 30 31 32 33 |
# File 'lib/clients/order_console.rb', line 27 def initialize conn, short_name # Create DataStream object super :stream_name => "#{short_name}_REPL", :type => P2::RT_COMBINED_DYNAMIC #, # :DBConnString => "P2DBSqLiteD.dll;;Log\\#{short_name}_.db" self.events.handler = self self.Open(conn) end |
Instance Method Details
#onStreamDataBegin(stream) ⇒ Object
69 70 71 |
# File 'lib/clients/order_console.rb', line 69 def onStreamDataBegin(stream) $log.puts "StreamDataBegin #{stream.StreamName} " end |
#onStreamDataDeleted(stream, table_name, id, rec) ⇒ Object
53 54 55 |
# File 'lib/clients/order_console.rb', line 53 def onStreamDataDeleted(stream, table_name, id, rec) $log.puts "StreamDataDeleted #{stream.StreamName} - #{table_name} - #{id}: #{wrap(rec)}" end |
#onStreamDataEnd(stream) ⇒ Object
73 74 75 |
# File 'lib/clients/order_console.rb', line 73 def onStreamDataEnd(stream) $log.puts "StreamDataEnd #{stream.StreamName} " end |
#onStreamDataInserted(stream, table_name, rec) ⇒ Object
44 45 46 47 |
# File 'lib/clients/order_console.rb', line 44 def onStreamDataInserted stream, table_name, rec return unless table_name == 'sys_messages' # Single out one table events $log.puts "StreamDataInserted #{stream.StreamName} - #{table_name}: #{wrap(rec)}" end |
#onStreamDataUpdated(stream, table_name, id, rec) ⇒ Object
49 50 51 |
# File 'lib/clients/order_console.rb', line 49 def onStreamDataUpdated(stream, table_name, id, rec) $log.puts "StreamDataUpdated #{stream.StreamName} - #{table_name} - #{id}: #{wrap(rec)}" end |
#onStreamDatumDeleted(stream, table_name, rev) ⇒ Object
57 58 59 |
# File 'lib/clients/order_console.rb', line 57 def onStreamDatumDeleted(stream, table_name, rev) $log.puts "StreamDatumDeleted #{stream.StreamName} - #{table_name} - #{rev}" end |
#onStreamDBWillBeDeleted(stream) ⇒ Object
61 62 63 |
# File 'lib/clients/order_console.rb', line 61 def onStreamDBWillBeDeleted(stream) $log.puts "StreamDBWillBeDeleted #{stream.StreamName} " end |
#onStreamLifeNumChanged(stream, life_num) ⇒ Object
65 66 67 |
# File 'lib/clients/order_console.rb', line 65 def onStreamLifeNumChanged(stream, life_num) $log.puts "StreamLifeNumChanged #{stream.StreamName} - #{life_num} " end |
#onStreamStateChanged(stream, new_state) ⇒ Object
Define Handlers for IP2DataStreamEvents event interface
40 41 42 |
# File 'lib/clients/order_console.rb', line 40 def onStreamStateChanged(stream, new_state) $log.puts "StreamStateChanged #{stream.StreamName} - #{state_text(new_state)}" end |
#wrap(rec) ⇒ Object
35 36 37 |
# File 'lib/clients/order_console.rb', line 35 def wrap(rec) P2::Record.new :ole => rec end |