Search in sources :

Example 1 with SessionActivityListener

use of org.eclipse.milo.opcua.sdk.client.SessionActivityListener in project JBM by numen06.

the class OpcUaClientBean method startUp.

@Override
protected void startUp() throws Exception {
    // add
    log.info("OPCUA客户端[{}]开始启动执行守护线程", deviceId);
    this.opcUaClient.addSessionActivityListener(new SessionActivityListener() {

        @Override
        public void onSessionActive(UaSession session) {
            log.info("PLC[{}][{}]建立链接成功", deviceId, session.getSessionName());
        }

        @Override
        public void onSessionInactive(UaSession session) {
            log.info("PLC[{}][{}]断开了链接", deviceId, session.getSessionName());
        }
    });
}
Also used : SessionActivityListener(org.eclipse.milo.opcua.sdk.client.SessionActivityListener) UaSession(org.eclipse.milo.opcua.sdk.client.api.UaSession)

Aggregations

SessionActivityListener (org.eclipse.milo.opcua.sdk.client.SessionActivityListener)1 UaSession (org.eclipse.milo.opcua.sdk.client.api.UaSession)1