This commit is contained in:
zhu4ling3 2018-04-08 10:31:33 -04:00
parent 244cfb0f7f
commit adf1cc6ff2

View File

@ -1,86 +1,117 @@
@startuml @startuml
database mongoDB as db
participant runDataRecord as run participant runDataRecord as run
participant mongoDB as db
participant MainEngine as me participant MainEngine as me
participant DataEngine as dt
participant LogEngine as le
participant DrEngine as dr participant DrEngine as dr
participant Queue as drq participant Queue as drq
participant Thread as drt
participant eventEngine as ee participant eventEngine as ee
participant Thread as eet
participant Queue as eeq participant Queue as eeq
participant ibGateway as gw participant ibGateway as gw
activate db
activate run activate run
'create ee run->ee ** :create evnetEngine object
run->ee: new evnetEngine()
activate ee activate ee
ee->ee ++ : init()
ee->eeq ** : Create Queue
ee->ee: __init__() ee->eet ** : Create Child Thread
activate ee return
create eeq return object
ee->eeq: Create Queue |||
activate eeq |||
ee->ee: Create Child Thread run->me ** : new mainEngine(ee)
deactivate ee
create me
run->me: new mainEngine(ee)
activate me activate me
me->ee: ee.start() me->me ++ : init()
note right me->ee ++ : ee.start()
启动ee的子线程 note right: 启动ee的子线程
end note ee->eet ++ #red : thread.start()
me->me:创建DataEngine() ee-->me--: return
me->dt ** :创建DataEngine()
activate dt
dt->dt ++ : init()
return
return object
me->le ** :创建LogEngine()
activate le
le->le ++ : init()
return
return
me-->me--:return
me-->run--:return object
|||
|||
run->me: addGateway(ibGateway) run->me: addGateway(ibGateway)
activate me
return
|||
|||
run->me: addApp() run->me: addApp()
run->ee: regiser() 注册日志处理事件 activate me
run->me: 连接IB网关 return
create dr |||
me->dr: new DrEngine(me,ee) |||
run->ee: ee.regiser() 注册日志处理事件
activate ee
return
|||
|||
run->me++: me.Connect(IB)
note right: 连接IB网关
me->dr**: new DrEngine(me,ee)
activate dr activate dr
dr->dr++:init()
dr->drq **:Create Queue
dr->drt **:Create Thread
activate drt #blue
dr->dr:loadSetting() dr->dr:loadSetting()
note right note right
从配置文件中加载 从配置文件中加载
订阅设置到字典对象 订阅设置到字典对象
end note end note
create drq dr->ee++:register(TICK, handler)
dr->drq:Create Queue return
activate drq dr-->dr -- : return
dr->ee:register(TICK, handler) 'return object
deactivate ee dr-->me--: object
gw-->eeq: queue.put(tick/bar) run<--me--:return
|||
|||
eet->ee--: ee.run()
activate ee #red activate ee #red
loop loop
ee->eeq:queue.get() ee->eeq:queue.get()
eeq-->ee: Message gw->eeq ++: queue.put(tick/bar)
ee->ee: process(mesage) return
end eeq-->ee: event
ee->dr:call procecssTickEvent() ee->ee ++ : __process(event)
deactivate ee ee->dr ++ #red :call procecssTickEvent()
activate dr #blue dr->dr ++ :OnTick()
dr->dr:OnTick() dr->drq ++: queue.put(tick)
activate dr return
dr->drq: queue.put(tick) return
deactivate dr
dr->dr:OnBar()
activate dr
dr->drq: queue.put(bar)
deactivate dr
deactivate dr
deactivate dr
dr->dr:run() dr->dr ++ :OnBar()
dr->drq ++: queue.put(bar)
return
return
return
return
end loop
deactivate ee
drt->dr -- :run()
activate dr #blue activate dr #blue
loop loop
dr->drq:queue.get() dr->drq ++ :queue.get()
drq-->dr:data drq-->dr --:data
dr->me:insertDB(data) dr->me:insertDB(data)
end end loop
deactivate dr deactivate dr
me->db: 写入mongoDB me->db: 写入mongoDB