blob: a6e96767afb04a99a03254d2a91dad6a20499f84 [file] [log] [blame]
== Salesforce Streaming API Example
This example shows how to use Salesforce Streaming API.
=== Configuring Salesforce
This examples uses OAuth 2.0 Refresh Token Flow, which requires 3 credentials collected from Salesforce - `Client ID`, `Client Secret` and `Refresh Token`. You will need to put your own credentials in `src/main/resources/` file.
NOTE: You might want to sign up with your own Developer account at After you have done that, youll need to create a Connected Application for your integration.
NOTE: This was written with Salesforce Lightening user interface. Classic user interface might have slightly different menu and/or workflow.
Here is an example workflow of creating a Connected Application and get required credentials. For more details, please check Salesforce online manual
==== Creating a Connected Application
. Go to `PLATFORM TOOLS > Apps > App Manager` in a navigation tree at the left of Salesforce Setup screen
. Click `New Connected App` button at the upper right
. Enter `camelk_knative_source_salesforce` for Connected App Name
. Enter your email address for Contact Email
. Check Enable OAuth Settings
. Enter `` for Callback URL
. Choose 2 OAuth scopes, `Access and manage your data (api)` and `Perform requests on your behalf at any time (refresh_token, offline_access)`, then click Add button
. Click Save button and then click Continue button
. You will be redirected to `Manage Connected Apps` page. `Consumer Key` and `Consumer Secret` are available in API section. Use `Consumer Key` as a `Client ID` and `Consumer Secret` as a `Client Secret`.
. Go to `PLATFORM TOOLS > Apps > Connected Apps > Manage Connected Apps`
. Click `Edit` next to the `camelk_knative_source_salesforce`
. In OAuth Policies section,
.. Choose `Relax IP restrictions` for IP Relaxation
.. Choose `Refresh token is valid until revoked`
. Click `Save`
==== Getting an OAuth refresh token
In your browser go to the URL, with substituting the `__YOUR_CLIENT_ID_HERE__` with your connected application Consumer Key:
Allow access to the application, and youll end up on a page with `refresh_token`, something like:
=== How to run
You can run this example using
$ mvn compile camel:run
=== Custom topic name and operation flags
You can specify your topic name (`salesforce.topic`) and turn on/off each operation to be notified (for example, set true for `camel.component.salesforce.config.notifyForOperationCreate` to receive Contact created event) in `src/main/resources/` file.
=== Help and contributions
If you hit any problem using Camel or have some feedback, then please[let us know].
We also love contributors, so[get involved] :-)
The Camel riders!