rts-sim-testing-service/message_server/simulation_tpapiservice_ms.go

20 lines
585 B
Go
Raw Permalink Normal View History

package message_server
import (
"fmt"
"time"
"joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/third_party"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
)
func NewTpapiServiceMs(vs *memory.VerifySimulation) ms_api.MsgTask {
return ms_api.NewScheduleTask(fmt.Sprintf("仿真第三方API服务[%s]状态", vs.SimulationId), func() error {
rss := third_party.GetRunningServiceStates()
mqtt.GetMsgClient().PubTpapiServiceState(vs.SimulationId, rss)
return nil
}, 1000*time.Millisecond)
}