简体   繁体   English

重新启动opc UA服务器时无法创建eclipse milo会话

[英]eclipse milo session not getting created when opc UA server restarts

I am using eclipse milo java OPCUA client SDK in our app for OPC implementation. 我在我们的应用程序中使用eclipse milo java OPCUA客户端SDK进行OPC实施。 I am able to create session, subscription and monitor. 我能够创建会话,订阅和监视。 It is working fine but when opc server restarts and I try to delete previous session and create a new one with same parameters I get the below exception: 它工作正常,但是当opc服务器重新启动时,我尝试删除上一个会话并使用相同的参数创建一个新会话时,出现以下异常:

UaException: status=Bad_Timeout, message=timed out waiting for acknowledge UaException:status = Bad_Timeout,消息=超时,等待确认

The line which throws the error is: 引发错误的行是:

EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints(endpointurl).get(); EndpointDescription []端点= UaTcpStackClient.getEndpoints(endpointurl).get();

On server side I get the error: 在服务器端,我得到了错误:

OPCUAServerEndPoint#_on_client_connection The maximum number of connection has b een reached - Connection is refused OPCUAServerEndPoint#_on_client_connection已达到最大连接数-拒绝连接

However, when I try to create the session again with same parameters it does get created 但是,当我尝试使用相同的参数再次创建会话时,确实会创建

You shouldn't be creating a session by yourself as this is handled for you by the client, and you definitely shouldn't be trying to delete the previous session. 您不应该自己创建会话,因为这是由客户端为您处理的,并且您绝对不应该尝试删除上一个会话。

The only thing you need to do is add a SubscriptionListener to the OpcUaSubscriptionManager and handle the onSubscriptionTransferFailed callback. 您唯一需要做的就是将一个SubscriptionListener添加到OpcUaSubscriptionManager并处理onSubscriptionTransferFailed回调。

Receiving this callback means that the client has reconnected and had to create a new session, but the server was unable to transfer its old subscriptions to this session. 收到此回调意味着客户端已重新连接并必须创建新的会话,但是服务器无法将其旧的订阅转移到该会话。 This usually happens when either it took too long to reconnect and the subscriptions timed out or if something causes the server to lose all of its state, eg it gets restarted. 当重新连接花费的时间太长并且订阅超时或由于某种原因导致服务器丢失其所有状态(例如重新启动)时,通常会发生这种情况。

I've added a somewhat convoluted integration test that demonstrates that all of this does indeed work, you can see it here . 我添加了一个复杂的集成测试,该测试证明所有这些操作确实有效,您可以在此处查看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM