Hello,

I think it might be related to the Salesforce API version. Camel uses 34.0
by default and I think you need, at least, 37.0. I noticed a similar
condition when working on the Salesforce test cases for the Camel Kafka
Connector.

I am quoting below the comment I added to the test case as to why this
seemed to happen on that occasion:

/*
* NOTE: this test requires SalesForce API >= than 37.0. Camel defaults to
* API version 34.0.
*
* The reason is that on older versions of this API did not return the list
* of supported extensions during the hand-shake (ie.:
* ext={replay=true, payload.format=true}). This behavior causes the rcvMeta
* handler on the CometDReplayExtension class in the salesforce component to
* consider the replay extension as "not supported".
*
* Subsequently, when using the /meta/subscribe channel to subscribe to
* account change events on /data/AccountChangeEvent, the replay ID is not
* provided on the request message - and it is a required parameter. This
* leads to a situation where the Salesforce API server returns a plain
* HTTP error 500 without much details.
*/

I hope this helps somehow.

Kind regards


On Thu, May 21, 2020 at 8:56 AM Anne Nguyen <smega...@gmail.com> wrote:

> Hi All,
>
> I'm trying to subscribe to a Platform Event in Salesforce:
>
> from("salesforce:event/Moodle__e?replayId=-1")
>     .streamCaching()
>     .process( exchange ->{
>         PlatformEvent event =
> exchange.getIn().getBody(PlatformEvent.class);
>         System.out.println("*********Receive Event : " +
> event.getEventData().toString());
>    });
>
> However receive the following error:
>
> 2020-05-21 14:23:35.061  WARN 3472 --- [ent@3cad68df-20]
> o.a.c.c.salesforce.SalesforceConsumer    : Error subscribing to
> event/Moodle__e: {httpCode=500}. Caused by:
> [org.apache.camel.component.salesforce.api.SalesforceException - Error
> subscribing to event/Moodle__e: {httpCode=500}]
>
> org.apache.camel.component.salesforce.api.SalesforceException: Error
> subscribing to event/Moodle__e: {httpCode=500}
>         at
> org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$7.onMessage(SubscriptionHelper.java:446)
> [camel-salesforce-3.4.0-SNAPSHOT.jar:3.4.0-SNAPSHOT]
>         at
> org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyOnMessage(AbstractClientSession.java:583)
> [cometd-java-common-4.0.4.jar:4.0.4]
>         at
> org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyMessageListeners(AbstractClientSession.java:568)
> [cometd-java-common-4.0.4.jar:4.0.4]
>         at
> org.cometd.common.AbstractClientSession.notifyListeners(AbstractClientSession.java:308)
> [cometd-java-common-4.0.4.jar:4.0.4]
>         at
> org.cometd.common.AbstractClientSession.lambda$receive$4(AbstractClientSession.java:269)
> [cometd-java-common-4.0.4.jar:4.0.4]
>         at org.cometd.bayeux.Promise$2.succeed(Promise.java:103)
> ~[bayeux-api-4.0.4.jar:4.0.4]
>         at
> org.cometd.common.AsyncFoldLeft$AbstractLoop.run(AsyncFoldLeft.java:199)
> ~[cometd-java-common-4.0.4.jar:4.0.4]
>         at org.cometd.common.AsyncFoldLeft.run(AsyncFoldLeft.java:93)
> ~[cometd-java-common-4.0.4.jar:4.0.4]
>         at
> org.cometd.common.AbstractClientSession.extendIncoming(AbstractClientSession.java:103)
> [cometd-java-common-4.0.4.jar:4.0.4]
>         at
> org.cometd.common.AbstractClientSession.receive(AbstractClientSession.java:263)
> [cometd-java-common-4.0.4.jar:4.0.4]
>         at
> org.cometd.client.BayeuxClient.failMessage(BayeuxClient.java:810)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
>         at
> org.cometd.client.BayeuxClient.messageFailure(BayeuxClient.java:806)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
>         at
> org.cometd.client.BayeuxClient.messagesFailure(BayeuxClient.java:659)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
>         at
> org.cometd.client.BayeuxClient$MessageTransportListener.onFailure(BayeuxClient.java:1266)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
>         at
> org.cometd.client.transport.LongPollingTransport$2.onComplete(LongPollingTransport.java:255)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
>         at
> org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:543)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:523)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:486)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:326)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.http.HttpParser.parseFields(HttpParser.java:1161)
> ~[jetty-http-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1534)
> ~[jetty-http-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:200)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:141)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:75)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:133)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:156)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at org.eclipse.jetty.io
> .AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
> ~[jetty-io-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at org.eclipse.jetty.io
> .FillInterest.fillable(FillInterest.java:103)
> ~[jetty-io-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:543)
> ~[jetty-io-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:398)
> ~[jetty-io-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:161)
> ~[jetty-io-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at org.eclipse.jetty.io
> .FillInterest.fillable(FillInterest.java:103)
> ~[jetty-io-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at org.eclipse.jetty.io
> .ChannelEndPoint$2.run(ChannelEndPoint.java:117)
> ~[jetty-io-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
> ~[jetty-util-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
> ~[jetty-util-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
> ~[jetty-util-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
> ~[jetty-util-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
> ~[jetty-util-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
> ~[jetty-util-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
> ~[jetty-util-9.4.27.v20200227.jar:9.4.27.v20200227]
>         at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_251]
> Caused by: org.cometd.common.TransportException: {httpCode=500}
>         at
> org.cometd.client.transport.LongPollingTransport$2.onComplete(LongPollingTransport.java:254)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
>         ... 28 common frames omitted
>
> I have successfully tested this event with other client app. I also
> tris this suggested solution to turn off the Salesforce Mobile
> Notification but still got the same error:
>
>
> https://salesforce.stackexchange.com/questions/55728/403unknown-client-error-when-connecting-to-streaming-api-push-topic/207824#207824
>
> Has anyone successfully subscribed to Salesforce Platform Event or has
> encountered this error and know how to workaround?
>
> Many Thanks
> Anne
>


-- 
Otavio R. Piske
http://orpiske.net

Reply via email to