Reputation: 223
I am using emp-connector for consuming salesforce straming API, I started with LogingExample from the salesforce documentation and its working file for API version 36.0, but when I try to use API Version 37.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
I know that API version 37.0 should be supported, so Not able to find out what am i doing wrong?
There is no issue with code as it works fine when I specify API version 36.0, still pasting the code here for reference
public class SFPoc {
public static void main(String[] argv) throws Exception {
String userName = "<someuser>";
String password = "<pwd>";
/*String pushTopicName = "/topic/InvoiceStatementUpdates";*/
String pushTopicName = "/topic/Lead2";
long replayFrom = EmpConnector.REPLAY_FROM_EARLIEST;
String securityToken = "<securityToken>";
BayeuxParameters custom = getBayeuxParamWithSpecifiedAPIVersion("37.0");
BayeuxParameters params = null;
try {
params = login(userName, password + securityToken, custom);
} catch (Exception e) {
e.printStackTrace();
}
Consumer<Map<String, Object>> consumer = event -> System.out.println(String.format("Received:\n%s", event));
EmpConnector connector = new EmpConnector(params);
connector.start().get(10, TimeUnit.SECONDS);
TopicSubscription subscription = connector.subscribe(pushTopicName, replayFrom, consumer).get(10, TimeUnit.SECONDS);
System.out.println(String.format("Subscribed: %s", subscription));
}
private static BayeuxParameters getBayeuxParamWithSpecifiedAPIVersion(String apiVersion) {
BayeuxParameters params = new BayeuxParameters() {
@Override
public String version() {
return apiVersion;
}
@Override
public String bearerToken() {
return null;
}
};
return params;
}
}
Upvotes: 1
Views: 573
Reputation: 46
I have pushed a change to master in the emp-connector that modifies the endpoints for versions < 37. Can you try this version and see if that fixes your issue?
Upvotes: 1