forcedotcom / EMP-Connector

A simplified cometd connector for Enterprise Messaging Platform
BSD 3-Clause "New" or "Revised" License
185 stars 243 forks source link

Issue#40-Not Closing HttpClient when reconnecting #62

Closed mohitj13 closed 4 years ago

mohitj13 commented 5 years ago

fix: Not closing the httpClient after getting 401 error instead disconnecting the Bayeux client only chore: Updating the cometd library

chandu1988 commented 4 years ago

Reconnect fails, please provide the alternative solution for this application, how to reconnect dynamically.

mohitj13 commented 4 years ago

@chandu1988 This does not fix the disconnection but it tries to successfully reconnects when gets a disconnect message, as it does not stop the httpClient and just reconnect the Bayeux client only.

chandu1988 commented 4 years ago

This does not fix the disconnection but it tries to successfully reconnects when gets a disconnect message, as it does not stop the httpClient and just reconnect the Bayeux client only can u please provided the sample code?

chandu1988 commented 4 years ago

can u please provided the sample code for reconnecting dynamically using httpClient and just reconnect the Bayeux client ?

mohitj13 commented 4 years ago

@chandu1988 this pr changes is all about that only. Look on the commits of this PR you can find the answer.

        @Override
        public void onMessage(ClientSessionChannel channel, Message message) {
            if (!message.isSuccessful()) {
                if (isError(message, ERROR_401) || isError(message, ERROR_403)) {
                    reauthenticate.set(true);
                    // stop(); this has been removed with disconnect method call
                    disconnect();
                    reconnect();
                }
            }
chandu1988 commented 4 years ago

@chandu1988 this pr changes is all about that only. Look on the commits of this PR you can find the answer.

        @Override
        public void onMessage(ClientSessionChannel channel, Message message) {
            if (!message.isSuccessful()) {
                if (isError(message, ERROR_401) || isError(message, ERROR_403)) {
                    reauthenticate.set(true);
                    // stop(); this has been removed with disconnect method call
                    disconnect();
                    reconnect();
                }
            }

can u please provided the sample code for reconnecting dynamically using httpClient and just reconnect the Bayeux client where i can implement this code please let me know.. how can i refer this method can u please provide the code ...