apache / plc4x

PLC4X The Industrial IoT adapter
https://plc4x.apache.org/
Apache License 2.0
1.2k stars 389 forks source link

[Feature Request]: How to handle reconnection after disconnection in a subscription? #1031

Open anganing opened 12 months ago

anganing commented 12 months ago

What would you like to happen?

hello,

How to handle reconnection after disconnection in a subscription? I couldn’t find any relevant examples on your official website.

connection.addDisconnectListener(event -> {
    // Handling logic when the connection is lost
    System.out.println("Connection lost. Reconnecting...");

    // Perform reconnection operations here, such as reconnecting or restarting the subscription process
});

Programming Languages

Protocols

splatch commented 12 months ago

Hello @anganing, I was facing similar issue with AMSADS, which lead to concept of (dis)connection listener. I am not sure if this API is fully supported for 0.11 build thus I'd need first to test that. With regard to subscriptions I believe we will face situation where diver and its internal state have them (and their handles/identifiers), however OPC UA server will not send any updates for them since connection for which these were made is gone.

chrisdutz commented 12 months ago

Yeah... That's a thing we need in the driver core of subscription drivers, but not implemented yet. Currently lukasz' approach is probably the best.