forcedotcom / EMP-Connector

A simplified cometd connector for Enterprise Messaging Platform
BSD 3-Clause "New" or "Revised" License
185 stars 242 forks source link

BayeuxParameters Streaming API version? #1

Closed jackydec closed 7 years ago

jackydec commented 7 years ago

In the interface BayeuxParameters, you specify the Streaming API version to 39.0.

Is this correct?

When creating the pushtopic as in the example (https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/create_a_pushtopic.htm#create_a_pushtopic) i cannot create it with pushTopic.ApiVersion = 39.0; Salesforce returns an error : Line: 10, Column: 1 System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD, Invalid ApiVersion: [ApiVersion]

If i change the api version to 38.0, SFDC creates the pushtopic without any problem.

Do the versions of the API in your code need to match the version in the PushTopic ?

When i try to run the LoginExample, i get following stacktrace ::

Exception in thread "main" java.util.concurrent.ExecutionException: java.net.ConnectException: Cannot connect [https://na39.salesforce.com/cometd/replay/38.0] : {exception=org.cometd.common.TransportException: {httpCode=400}, message={ext={replay=true}, supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=1, version=1.0}, httpCode=400, connectionType=long-polling} at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) at com.salesforce.emp.connector.example.LoginExample.main(LoginExample.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.net.ConnectException: Cannot connect [https://na39.salesforce.com/cometd/replay/38.0] : {exception=org.cometd.common.TransportException: {httpCode=400}, message={ext={replay=true}, supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=1, version=1.0}, httpCode=400, connectionType=long-polling} at com.salesforce.emp.connector.EmpConnector.lambda$connect$3(EmpConnector.java:224) at org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyOnMessage(AbstractClientSession.java:500) at org.cometd.common.AbstractClientSession.notifyListener(AbstractClientSession.java:267) at org.cometd.client.BayeuxClient.notifyListeners(BayeuxClient.java:999) at org.cometd.common.AbstractClientSession.receive(AbstractClientSession.java:241) at org.cometd.client.BayeuxClient.failMessage(BayeuxClient.java:987) at org.cometd.client.BayeuxClient.failMessages(BayeuxClient.java:962) at org.cometd.client.BayeuxClient$PublishTransportListener.onFailure(BayeuxClient.java:1199) at org.cometd.client.BayeuxClient$HandshakeTransportListener.onFailure(BayeuxClient.java:1248) at org.cometd.client.transport.LongPollingTransport$2.onComplete(LongPollingTransport.java:279) at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193) at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185) at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:446) at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:393) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:265) at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1514) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1272) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:156) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:117) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:69) at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:89) at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:122) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745)

I'm not behind a proxy server and when i'm consulting the login history in SFDC, i can see a succesfull login.

My params for the LoginExample are "user password /topic/InvoiceStatementUpdates"

what am i doing wrong?

sfdc-dxu commented 7 years ago

NA39 is still on API version 38.0.

sourabhrajput commented 7 years ago

I faced similar issue, but I am facing another additional issue, even after specifying API version 37.0 Or 38.0... I am getting following response back [{"channel":"/meta/handshake","error":"400::Unsupported API version. Only API versions '35.0' and '36.0' are supported.","successful":false}] and when I specify API version 36.0 I code is working fine and recieving event via PushTopic

Not able to find out what am i doing wrong?