zhoushihao
2024-10-11 f4644873804165e9db88375f242421f00b0903f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.mes.job;
 
import com.mes.milo.runner.subscription.SubscriptionCallback;
import com.mes.milo.service.MiloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.util.Arrays;
 
/**
 * @Author : zhoush
 * @Date: 2024/10/10 8:05
 * @Description:
 */
@Component
@Slf4j
public class OpcCacheGlassTask {
 
    @Autowired
    MiloService miloService;
 
    @Autowired
    SubscriptionCallback cacheGlassSubscriptionCallback;
 
    @Scheduled(fixedDelay = Long.MAX_VALUE)
    public void startOpcTask() throws Exception {
        miloService.subscriptionFromOpcUa(Arrays.asList("my.device.x1", "my.device.x2"), cacheGlassSubscriptionCallback);
    }
}