libab
libab

Reputation: 25

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?

Upvotes: 1

Views: 1233

Answers (1)

Kevin Herron
Kevin Herron

Reputation: 6985

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.

Upvotes: 3

Related Questions