Search in sources :

Example 1 with PushTopicHelper

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;
}
Also used : RestClient(org.apache.camel.component.salesforce.internal.client.RestClient) DefaultRestClient(org.apache.camel.component.salesforce.internal.client.DefaultRestClient) DefaultRestClient(org.apache.camel.component.salesforce.internal.client.DefaultRestClient) PushTopicHelper(org.apache.camel.component.salesforce.internal.streaming.PushTopicHelper)

Aggregations

DefaultRestClient (org.apache.camel.component.salesforce.internal.client.DefaultRestClient)1 RestClient (org.apache.camel.component.salesforce.internal.client.RestClient)1 PushTopicHelper (org.apache.camel.component.salesforce.internal.streaming.PushTopicHelper)1