package com.dy.rtuMw.server.msCenter;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* @Author: liurunyu
|
* @Date: 2025/2/12 15:35
|
* @Description
|
*/
|
//使起作用,本类注解@Component,并在PipIrrMwRtuApplication注解@EnableScheduling
|
@Component
|
public class TestMsResource {
|
|
// 设置定时十秒一次
|
@Scheduled(cron = "0/1 * * * * ?")
|
public void WsHeartBeat() throws Exception {
|
MsObj obj = new MsObj() ;
|
obj.put("id", System.currentTimeMillis());
|
obj.put("ms", "消息" + System.currentTimeMillis());
|
MsCenterUnit.getInstance().pushMs(obj);
|
}
|
|
}
|