You need to sign in to do that
Don't have an account?
Streaming API - Channel Getting Disconnected after certain interval
Hi Everyone,
I am using the code sample provided Java client for Streaming API in the below link
http://www.salesforce.com/developer/docs/api_streaming/Content/code_sample_java_add_source.htm
I am not able to understand why the channel is getting disconnected after sometime. Is there a way to keep the channel alive? I have a requirement where i dont want to miss out on any of the events in salesforce. And disconnection will certainly lead to data loss.
Below are the logs that appear whenever channel is getting disconnected.
[CHANNEL:META_CONNECT]: {"id":"133048","successful":true,"channel":"/meta/connect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
[CHANNEL:META_DISCONNECT]: {"successful":true,"channel":"/meta/disconnect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
[CHANNEL:META_CONNECT]: {"id":"133049","successful":true,"channel":"/meta/connect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
[CHANNEL:META_CONNECT]: {"id":"133050","error":"403::Unknown client","successful":false,"advice":{"interval":500,"reconnect":"handshake"},"channel":"/meta/connect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
Error during CONNECT: 403::Unknown client
Exiting...
An early response on this would be highly appreciated.
Thanks,
Shalindra
I am using the code sample provided Java client for Streaming API in the below link
http://www.salesforce.com/developer/docs/api_streaming/Content/code_sample_java_add_source.htm
I am not able to understand why the channel is getting disconnected after sometime. Is there a way to keep the channel alive? I have a requirement where i dont want to miss out on any of the events in salesforce. And disconnection will certainly lead to data loss.
Below are the logs that appear whenever channel is getting disconnected.
[CHANNEL:META_CONNECT]: {"id":"133048","successful":true,"channel":"/meta/connect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
[CHANNEL:META_DISCONNECT]: {"successful":true,"channel":"/meta/disconnect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
[CHANNEL:META_CONNECT]: {"id":"133049","successful":true,"channel":"/meta/connect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
[CHANNEL:META_CONNECT]: {"id":"133050","error":"403::Unknown client","successful":false,"advice":{"interval":500,"reconnect":"handshake"},"channel":"/meta/connect","clientId":"1zro8qr2rfbesar24zjqa3okgvv"}
Error during CONNECT: 403::Unknown client
Exiting...
An early response on this would be highly appreciated.
Thanks,
Shalindra
When a client first subscribes or reconnects, it doesn’t receive messages that were processed while it wasn’t subscribed to the channel.
If a client disconnects and starts a new handshake, it may be working with a different application server, so it receives only new messages from that point on.
Some events may be dropped if the system is being heavily used.
If an application server is stopped, all the messages being processed but not yet sent are lost.
Non Reluability in Message delivery is known from Salesforce documentation. But once I have subscribed to event (push topic) and my server is up and running, then also channel is getting discunnected automatcally after certain interval. which require me to again subscribe to same push topic (such behaviour is not documentd in Salesforce documentation). In my opinion this should not be the case. Once I have subscribed to event (push topic) it should continue to listen to that event unless server is down or i unsubscribe it.
Or am I missing some configuration related to channel disconnection?
Thanks
Shalndra Singh
Here is a piece of information that may help you out, first; check the link below, which basically saying disconnection may happen from time to time based on bunch of various factors which when this happens, recommending start all over again;
http://www.salesforce.com/developer/docs/api_streaming/Content/DebuggingStreamingAPIApplications.htm
Second; another piece of information that may be useful to you is that in Version 28.0 API document (Summer '13), they state as below (which is not placed in later docs);
Maximum CometD session lifetime: 2 hours
A client subscription is valid for a maximum of 2 hours, irrespective of activity on the connection. Therefore the client must handshake, subscribe, and connect before the session is timed out on the server side. A new subscription creates a new server session: the server timeout clock restarts again.
This may be your case.. There are a lot of factors that may contribute to disconnection. Since the server actually looks for some sort of 'activity', I suggest do a "handshake" with a timer/thread so that you have constant activity on server which restarts your session clock again. Even in this case, you may get disconnections which then you need to start all over again.
Hope this helps.
Another real problem is that sometimes after a successful re-handshake I get a connect response: I am confused by advice={reconnect=none, interval=0}. The Cometd Java client handles it by putting the client into DISCONNECTED state.
It is a server way to tell its clients to disconnect? E.g. beacuse it is shutting down?