Striim 3.9.4 / 3.9.5 documentation

SalesforceReader

Reads Salesforce sObject data. See also SalesforcePlatformEventReader and SalesforcePushTopicReader.

property

type

default value

notes

API End Point

java.lang.String

endpoint for your Force.com REST API

Auth Token

com.webaction. security.Password

If autoAuthTokenRenewal is set to false , specify your Salesforce access token (see Set Up Authorization on developer.salesforce.com: the first section, "Setting Up OAuth 2.0," explains how to create a "connected app"; the second section, "Session ID Authorization," explains how to get the token using curl).

If autoAuthTokenRenewal is set to true, leave blank.

Auto Auth Token Renewal

java.lang.String

false

Set to true if you want the access token to be renewed automatically so the application can run continuously. 

Connection Retry Policy

java.lang.String

retryInterval=30, maxRetries=3

The connection retry policy includes retryInterval and maxRetries. With the default setting, if a connection attempt is unsuccessful, the adapter will try again in 30 seconds (retryInterval. If the second attempt is unsuccessful, in 30 seconds it will try a third time (maxRetries). If that is unsuccessful, the adapter will fail and log an exception. Negative values are not supported.

When autoAuthTokenRenewal is false, this setting has no effect.

Consumer Key

java.lang.String

If autoAuthTokenRenewal is set to true, specify the Consumer Key (see Set Up Authorization on developer.salesforce.com).

Consumer Secret

com.webaction. security.Password

If autoAuthTokenRenewal is set to true, specify the Consumer Secret (see Set Up Authorization on developer.salesforce.com).

Mode

java.lang.String

InitialLoad

With the default setting, will load all existing data using force-rest-api 0.28 and stop.

Set to BulkLoad to load all existing data using the Salesforce Bulk API and stop.

Set to Incremental to read new data continuously using force-rest-api 0.28.

Password

com.webaction. security.Password

If autoAuthTokenRenewal is set to true, specify the password for the specified username.

Polling Interval

java.lang.String

5 min

how often the data will be read, in minutes: Salesforce recommends the default value, the maximum value is 120

Security Token

java.lang.String

If autoAuthTokenRenewal is set to true, specify the security token for the specified username (see Reset Your Security Token on help.salesforce.com).

sObject

java.lang.String

the object to read, for example, Customer or PO (the account associated with the authToken must have View All Data permission for the object)

Username

java.lang.String

If autoAuthTokenRenewal is set to true, specify an appropriate username (see Add a Single User on help.salesforce.com).

The output type is WAEvent.

Use the following cURL commands (see Using cURL in the REST Examples and curl.haxx.se) to verify your configuration and get information about available resources and sObjects.

  1. Get an access token using the Salesforce login URL.

    curl https://login.salesforce.com/services/oauth2/token -d "grant_type=password" \
    -d "client_id=<your consumer key>" -d "client_secret=<your consumer secret>" \
    -d "username=<your username>" -d "password=<your password>"
    
  2. Using the access token returned by that command, test the REST API URL for your organization. The instance is typically the first part of the URL you see in your browser when logged into Salesforce, such as "mycompany" in mycompany.salesforce.com. Alternatively, ask your Salesforce technical administrator for access to a connected app. (For more information, see Understanding the Username-Password OAuth Authentication Flow.)

    If you do not have a proxy server:

    curl https://<your Salesforce instance>.salesforce.com/services/data/ \
    -H 'Authorization: Bearer <token>'

    If you have a proxy server (change the proxy server URL to match yours):

    curl -x http://mycompany.proxy.server.com:8080/ \
    https://<your Salesforce instance >.salesforce.com/services/data/ \
    -H 'Authorization: Bearer <token>'
  3. List available REST resources and sObjects (see List Available REST Resources and Get a List of Objects).

    curl https://<your Salesforce instance>.salesforce.com/services/data/v41.0 \
    -H 'Authorization: Bearer <token>'
    curl https://<your Salesforce instance>.salesforce.com/services/data/v41.0/sobjects \
    -H 'Authorization: Bearer <token>'
    

For additional information, see Salesforce's REST API Developer Guide .

The following TQL will read from the Business__c sObject and create an appropriate typed stream:

CREATE SOURCE SFPoller USING SalesforceReader ( 
  sObject: 'Business__c',
  authToken: '********',
  mode: 'InitialLoad'
) 
OUTPUT TO DataStream;

CREATE TYPE OpStream_Type  (
  Id String KEY,
  Name String, 
  POSDataCode__c String, 
  Currency__c String 
);
CREATE OR REPLACE STREAM OpStream OF OpStream_Type;

CREATE OR REPLACE CQ CQ1 
INSERT INTO OpStream
SELECT data[0],data[1],data[2],data[3]
FROM DataStream;