We are currently using Camel 4.6.0 salesforce component. We upgraded recently from 3.x. Every 3-4 hours, the component fails with the below error:
o.a.c.c.s.i.s.SubscriptionHelper.lambda$onMessage$0 -Connect failure: {advice={reconnect=handshake, interval=0}, channel=/meta/connect, id=234, error=403::Unknown client, successful=false} –
A few seconds later we start seeing the below in the logs:
o.a.c.c.s.i.s.SubscriptionHelper.lambda$onMessage$0 -Handshake failure: {failure={exception=java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@20a0f8d3[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@2a5893a3[Wrapped task = org.cometd.client.http.jetty.JettyHttpClientTransport$$Lambda$2343/0x00007fd8cfe7c5e0@249f6898]] rejected from org.cometd.client.BayeuxClient$Scheduler@65a262a3[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 162], message={ext={replay=true}, supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=237, version=1.0}, connectionType=long-polling}, channel=/meta/handshake, id=237, successful=false}
Looks like the component then tries to reconnect every 30 seconds, but what we see is the above error being logged every 30 secs. The component fails to reconnect after that. We have to restart the app.
To try to force salesforce component to reconnet we have set bridgeEndpoint to true on the consumer and the onException() handler doesn’t seem to get called.
onException(SalesforceException.class)
.onWhen(simple("${exception.message} ~~ 'error=403::Unknown client'"))
.handled(true)
.log(LoggingLevel.ERROR,"SalesforceException Handshake Failure")
.log("Route sf-change-events-consumer status ${body}")
.to(uses controlbus to restart the below route)
.end();
from("sf-change-events-consumer:salesforce:subscribe:{{salesforce.change-events.channel}}?initialReplayIdMap=#sfInitialReplayIdMap&bridgeErrorHandler=true")
.
.
.
end();
What am I doing wrong ? My understanding was that bridgeEndpoint will invoke the onException handler defined above the route definition ?
When 403 is received, the expectation is that the bridge error handler is called that can restart the route and force a handshake/reconnection to salesforce.
If the above mechanism to catch the exception and restart is not the right way to go, what can I do to ensure that reconnection works ?
Dinesh Somalingam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.