简体   繁体   中英

Eclipse Milo doesn't reconnect to server after lost connection - subscriptions

I am working on subscriptions with Milo and I am trying to make re-connection after connection to server is lost. I subscribe a few thousands of nodes. I added custom SubscriptionListener and after I break a network I receive calls to onPublishFailure() in my SubscriptionListener where I invoke subscriptionManager.clearSubscriptions() and then I resubscribe the same nodes but nothing happens after that.

What's correct approach to handle a lost connection to server for subscriptions?

The correct approach is mostly to do nothing - all of the details of reconnecting are handled automatically.

The only case you need to handle is when the subscriptions were unable to be transferred after a new session was created. Implement SubscriptionListener#onSubscriptionTransferFailed to re-create any subscription this callback indicates has failed to transfer.

There's not really any other scenario where you should be manually clearing and re-creating your subscriptions. The onPublishFailure() callback is largely informational and does not require action.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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