use of org.apache.camel.component.salesforce.internal.streaming.PushTopicHelper in project camel by apache.
the class SalesforceConsumer method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
final SalesforceEndpointConfig config = endpoint.getConfiguration();
// is a query configured in the endpoint?
if (config.getSObjectQuery() != null) {
// Note that we don't lookup topic if the query is not specified
// create REST client for PushTopic operations
SalesforceComponent component = endpoint.getComponent();
RestClient restClient = new DefaultRestClient(component.getConfig().getHttpClient(), endpoint.getConfiguration().getApiVersion(), endpoint.getConfiguration().getFormat(), component.getSession());
// don't forget to start the client
ServiceHelper.startService(restClient);
try {
PushTopicHelper helper = new PushTopicHelper(config, topicName, restClient);
helper.createOrUpdateTopic();
} finally {
// don't forget to stop the client
ServiceHelper.stopService(restClient);
}
}
// subscribe to topic
subscriptionHelper.subscribe(topicName, this);
subscribed = true;
}
Aggregations