function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
theWebDevtheWebDev 

Streaming API

We are using the streaming API in our workplace to stream data about certain objects down to our application databases. What we've noticed is that during Salesforce maintenance periods or performance degradation, our communication drops and we do not have a way to reconnect properly at this time. I am curious if anyone else has also had this issue and how they have gone about solving it.

 

Below is an example of the type of error we encounter once teh communication starts to fail. This message repeats until we manually reconnect at this time:

 

2012-06-18 11:59:16,535 [HttpClient-26] INFO org.cometd.client.BayeuxClient@1875064030 - Messages failed [{"id":"24","connectionType":"long-polling","channel":"/meta/connect","clientId":"591o3gs1u56o0t4bqw9r7irb824"}]
java.net.ProtocolException: Unexpected response 401: TransportExchange@1691151590=POST//cs2-api.salesforce.com:443/cometd/24.0/connect#7
at org.cometd.client.BayeuxClient$PublishTransportListener.onProtocolError(BayeuxClient.java:1106)
at org.cometd.client.transport.LongPollingTransport$TransportExchange.onResponseComplete(LongPollingTransport.java:304)
at org.eclipse.jetty.client.HttpExchange$Listener.onResponseComplete(HttpExchange.java:968)
at org.eclipse.jetty.client.HttpExchange.setStatus(HttpExchange.java:279)
at org.eclipse.jetty.client.HttpConnection$Handler.messageComplete(HttpConnection.java:619)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:862)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:275)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Unknown Source)

 

Thanks in advance!