3

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":"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, Himanshu

2

I guess the topic is kind of outdated but in case Himanshu still needs it; I had a similar issue with a java client and push topics, took a couple days to find out that the cometd is actually dropping the connection, it was 2 hours in my case (default), yours may be different. That detail is given in old pdfs but not in the new one. So in short; renew the connection before it times out, meaning; unsubscribe (to prevent duplication), disconnect, connect, handshake and subscribe again. Hope it helps. Cheers.


In addition to my original post, on the page below Salesforce says it "may" happen, with a quite similar sample message to your problem. And it all goes back to the same solution, start over. connect, handshake, subscribe...

http://www.salesforce.com/developer/docs/api_streaming/Content/DebuggingStreamingAPIApplications.htm

1

Please read Salesforce Help Documentation (http://www.salesforce.com/developer/docs/api_streaming/) - Message Reliability :

Streaming API doesn’t guarantee durability and reliable delivery of notifications. Streaming servers don’t maintain any client state and don’t keep track of what’s delivered. The client may not receive messages for a variety of reasons, including: - 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. Any clients connected to that application server are disconnected. To receive notifications, the client must reconnect and subscribe to the topic channel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.