Este contenido no está disponible en el idioma seleccionado.

Chapter 289. Salesforce Component


Available as of Camel version 2.12

This component supports producer and consumer endpoints to communicate with Salesforce using Java DTOs.
There is a companion maven plugin Camel Salesforce Plugin that generates these DTOs (see further below).

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-salesforce</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
Note

Developers wishing to contribute to the component are instructed to look at the README.md file on instructions on how to get started and setup your environment for running integration tests.

289.1. Authenticating to Salesforce

The component supports three OAuth authentication flows:

For each of the flow different set of properties needs to be set:

Table 289.1. Properties to set for each authentication flow
PropertyWhere to find it on SalesforceFlow

clientId

Connected App, Consumer Key

All flows

clientSecret

Connected App, Consumer Secret

Username-Password, Refresh Token

userName

Salesforce user username

Username-Password, JWT Bearer Token

password

Salesforce user password

Username-Password

refreshToken

From OAuth flow callback

Refresh Token

keystore

Connected App, Digital Certificate

JWT Bearer Token

The component auto determines what flow you’re trying to configure, to be remove ambiguity set the authenticationType property.

Note

Using Username-Password Flow in production is not encouraged.

Note

The certificate used in JWT Bearer Token Flow can be a selfsigned certificate. The KeyStore holding the certificate and the private key must contain only single certificate-private key entry.

289.2. URI format

When used as a consumer, receiving streaming events, the URI scheme is:

salesforce:topic?options

When used as a producer, invoking the Salesforce RSET APIs, the URI scheme is:

salesforce:operationName?options

You can append query options to the URI in the following format, ?option=value&option=value&…​

289.3. Passing in Salesforce headers and fetching Salesforce response headers

With Camel 2.21 there is support to pass Salesforce headers via inbound message headers, header names that start with Sforce or x-sfdc on the Camel message will be passed on in the request, and response headers that start with Sforce will be present in the outboud message headers.

For example to fetch API limits you can specify:

// in your Camel route set the header before Salesforce endpoint
//...
  .setHeader("Sforce-Limit-Info", constant("api-usage"))
  .to("salesforce:getGlobalObjects")
  .to(myProcessor);

// myProcessor will receive `Sforce-Limit-Info` header on the outbound
// message
class MyProcessor implements Processor {
    public void process(Exchange exchange) throws Exception {
        Message in = exchange.getIn();
        String apiLimits = in.getHeader("Sforce-Limit-Info", String.class);
   }
}

289.4. Supported Salesforce APIs

The component supports the following Salesforce APIs

Producer endpoints can use the following APIs. Most of the APIs process one record at a time, the Query API can retrieve multiple Records.

289.4.1. Rest API

You can use the following for operationName:

  • getVersions - Gets supported Salesforce REST API versions
  • getResources - Gets available Salesforce REST Resource endpoints
  • getGlobalObjects - Gets metadata for all available SObject types
  • getBasicInfo - Gets basic metadata for a specific SObject type
  • getDescription - Gets comprehensive metadata for a specific SObject type
  • getSObject - Gets an SObject using its Salesforce Id
  • createSObject - Creates an SObject
  • updateSObject - Updates an SObject using Id
  • deleteSObject - Deletes an SObject using Id
  • getSObjectWithId - Gets an SObject using an external (user defined) id field
  • upsertSObject - Updates or inserts an SObject using an external id
  • deleteSObjectWithId - Deletes an SObject using an external id
  • query - Runs a Salesforce SOQL query
  • queryMore - Retrieves more results (in case of large number of results) using result link returned from the 'query' API
  • search - Runs a Salesforce SOSL query
  • limits - fetching organization API usage limits
  • recent - fetching recent items
  • approval - submit a record or records (batch) for approval process
  • approvals - fetch a list of all approval processes
  • composite - submit up to 25 possibly related REST requests and receive individual responses
  • composite-tree - create up to 200 records with parent-child relationships (up to 5 levels) in one go
  • composite-batch - submit a composition of requests in batch
  • queryAll - Runs a SOQL query. It returns the results that are deleted because of a merge or delete. Also returns the information about archived Task and Event records.
  • getBlobField - Retrieves the specified blob field from an individual record.
  • apexCall - Executes a user defined APEX REST API call.

For example, the following producer endpoint uses the upsertSObject API, with the sObjectIdName parameter specifying 'Name' as the external id field. The request message body should be an SObject DTO generated using the maven plugin. The response message will either be null if an existing record was updated, or CreateSObjectResult with an id of the new record, or a list of errors while creating the new object.

...to("salesforce:upsertSObject?sObjectIdName=Name")...

289.4.2. Bulk 2.0 API

The Bulk 2.0 API has a simplified model over the original Bulk API. Use it to quickly load a large amount of data into Salesforce, or query a large amount of data out of Salesforce. Data must be provided in CSV format. The minimum API version for Bulk 2.0 is v41.0. The minimum API version for Bulk Queries is v47.0. DTO classes mentioned below are from the org.apache.camel.component.salesforce.api.dto.bulkv2 package. The following operations are supported:

  • bulk2CreateJob - Create a bulk job. Supply an instance of Job in the message body.
  • bulk2GetJob - Get an existing Job. jobId parameter is required.
  • bulk2CreateBatch - Add a Batch of CSV records to a job. Supply CSV data in the message body. The first row must contain headers. jobId parameter is required.
  • bulk2CloseJob - Close a job. You must close the job in order for it to be processed or aborted/deleted. jobId parameter is required.
  • bulk2AbortJob - Abort a job. jobId parameter is required.
  • bulk2DeleteJob - Delete a job. jobId parameter is required.
  • bulk2GetSuccessfulResults - Get successful results for a job. Returned message body will contain an InputStream of CSV data. jobId parameter is required.
  • bulk2GetFailedResults - Get failed results for a job. Returned message body will contain an InputStream of CSV data. jobId parameter is required.
  • bulk2GetUnprocessedRecords - Get unprocessed records for a job. Returned message body will contain an InputStream of CSV data. jobId parameter is required.
  • bulk2GetAllJobs - Get all jobs. Response body is an instance of Jobs. If the done property is false, there are additional pages to fetch, and the nextRecordsUrl property contains the value to be set in the queryLocator parameter on subsequent calls.
  • bulk2CreateQueryJob - Create a bulk query job. Supply an instance of QueryJob in the message body.
  • bulk2GetQueryJob - Get a bulk query job. jobId parameter is required.
  • bulk2GetQueryJobResults - Get bulk query job results. jobId parameter is required.
  • bulk2AbortQueryJob - Abort a bulk query job. jobId parameter is required.
  • bulk2DeleteQueryJob - Delete a bulk query job. jobId parameter is required.
  • bulk2GetAllQueryJobs - Get all jobs. Response body is an instance of QueryJobs. If the done property is false, there are additional pages to fetch, and the nextRecordsUrl property contains the value to be set in the queryLocator parameter on subsequent calls.

289.4.3. Rest Bulk (original) API

Producer endpoints can use the following APIs. All Job data formats, i.e. xml, csv, zip/xml, and zip/csv are supported.
The request and response have to be marshalled/unmarshalled by the route. Usually the request will be some stream source like a CSV file,
and the response may also be saved to a file to be correlated with the request.

You can use the following for operationName:

  • createJob - Creates a Salesforce Bulk Job
  • getJob - Gets a Job using its Salesforce Id
  • closeJob - Closes a Job
  • abortJob - Aborts a Job
  • createBatch - Submits a Batch within a Bulk Job
  • getBatch - Gets a Batch using Id
  • getAllBatches - Gets all Batches for a Bulk Job Id
  • getRequest - Gets Request data (XML/CSV) for a Batch
  • getResults - Gets the results of the Batch when its complete
  • createBatchQuery - Creates a Batch from an SOQL query
  • getQueryResultIds - Gets a list of Result Ids for a Batch Query
  • getQueryResult - Gets results for a Result Id
  • getRecentReports - Gets up to 200 of the reports you most recently viewed by sending a GET request to the Report List resource.
  • getReportDescription - Retrieves the report, report type, and related metadata for a report, either in a tabular or summary or matrix format.
  • executeSyncReport - Runs a report synchronously with or without changing filters and returns the latest summary data.
  • executeAsyncReport - Runs an instance of a report asynchronously with or without filters and returns the summary data with or without details.
  • getReportInstances - Returns a list of instances for a report that you requested to be run asynchronously. Each item in the list is treated as a separate instance of the report.
  • getReportResults: Contains the results of running a report.

For example, the following producer endpoint uses the createBatch API to create a Job Batch. The in message must contain a body that can be converted into an InputStream (usually UTF-8 CSV or XML content from a file, etc.) and header fields 'jobId' for the Job and 'contentType' for the Job content type, which can be XML, CSV, ZIP_XML or ZIP_CSV. The put message body will contain BatchInfo on success, or throw a SalesforceException on error.

...to("salesforce:createBatchJob")..

289.4.4. Rest Streaming API

Consumer endpoints can use the following sytax for streaming endpoints to receive Salesforce notifications on create/update.

To create and subscribe to a topic

from("salesforce:CamelTestTopic?notifyForFields=ALL&notifyForOperations=ALL&sObjectName=Merchandise__c&updateTopic=true&sObjectQuery=SELECT Id, Name FROM Merchandise__c")...

To subscribe to an existing topic

from("salesforce:CamelTestTopic&sObjectName=Merchandise__c")...

289.4.5. Platform events

To emit a platform event use createSObject operation. And set the message body can be JSON string or InputStream with key-value data — in that case sObjectName needs to be set to the API name of the event, or a class that extends from AbstractDTOBase with the appropriate class name for the event.

For example using a DTO:

class Order_Event__e extends AbstractDTOBase {
  @JsonProperty("OrderNumber")
  private String orderNumber;
  // ... other properties and getters/setters
}

from("timer:tick")
    .process(exchange -> {
        final Message in = exchange.getIn();
        String orderNumber = "ORD" + String.valueOf(in.getHeader(Exchange.TIMER_COUNTER));
        Order_Event__e event = new Order_Event__e();
        event.setOrderNumber(orderNumber);
        in.setBody(event);
    })
    .to("salesforce:createSObject");

Or using JSON event data:

from("timer:tick")
    .process(exchange -> {
        final Message in = exchange.getIn();
        String orderNumber = "ORD" + String.valueOf(in.getHeader(Exchange.TIMER_COUNTER));
        in.setBody("{\"OrderNumber\":\"" + orderNumber + "\"}");
    })
    .to("salesforce:createSObject?sObjectName=Order_Event__e");

To receive platform events use the consumer endpoint with the API name of the platform event prefixed with event/ (or /event/), e.g.: salesforce:events/Order_Event__e. Processor consuming from that endpoint will receive either org.apache.camel.component.salesforce.api.dto.PlatformEvent object or org.cometd.bayeux.Message in the body depending on the rawPayload being false or true respectively.

For example, in the simplest form to consume one event:

PlatformEvent event = consumer.receiveBody("salesforce:event/Order_Event__e", PlatformEvent.class);

289.5. Examples

289.5.1. Uploading a document to a ContentWorkspace

Create the ContentVersion in Java, using a Processor instance:

public class ContentProcessor implements Processor {
    public void process(Exchange exchange) throws Exception {
        Message message = exchange.getIn();

        ContentVersion cv = new ContentVersion();
        ContentWorkspace cw = getWorkspace(exchange);
        cv.setFirstPublishLocationId(cw.getId());
        cv.setTitle("test document");
        cv.setPathOnClient("test_doc.html");
        byte[] document = message.getBody(byte[].class);
        ObjectMapper mapper = new ObjectMapper();
        String enc = mapper.convertValue(document, String.class);
        cv.setVersionDataUrl(enc);
        message.setBody(cv);
    }

    protected ContentWorkspace getWorkSpace(Exchange exchange) {
        // Look up the content workspace somehow, maybe use enrich() to add it to a
        // header that can be extracted here
        ....
    }
}

Give the output from the processor to the Salesforce component:

from("file:///home/camel/library")
    .to(new ContentProcessor())     // convert bytes from the file into a ContentVersion SObject
                                    // for the salesforce component
    .to("salesforce:createSObject");

289.6. Using Salesforce Limits API

With salesforce:limits operation you can fetch of API limits from Salesforce and then act upon that data received. The result of salesforce:limits operation is mapped to org.apache.camel.component.salesforce.api.dto.Limits class and can be used in a custom processors or expressions.

For instance, consider that you need to limit the API usage of Salesforce so that 10% of daily API requests is left for other routes. The body of output message contains an instance of org.apache.camel.component.salesforce.api.dto.Limits object that can be used in conjunction with Content Based Router and Content Based Router and Spring Expression Language (SpEL) to choose when to perform queries.

Notice how multiplying 1.0 with the integer value held in body.dailyApiRequests.remaining makes the expression evaluate as with floating point arithmetic, without it - it would end up making integral division which would result with either 0 (some API limits consumed) or 1 (no API limits consumed).

from("direct:querySalesforce")
    .to("salesforce:limits")
    .choice()
    .when(spel("#{1.0 * body.dailyApiRequests.remaining / body.dailyApiRequests.max < 0.1}"))
        .to("salesforce:query?...")
    .otherwise()
        .setBody(constant("Used up Salesforce API limits, leaving 10% for critical routes"))
    .endChoice()

289.7. Working with approvals

All the properties are named exactly the same as in the Salesforce REST API prefixed with approval.. You can set approval properties by setting approval.PropertyName of the Endpoint these will be used as template — meaning that any property not present in either body or header will be taken from the Endpoint configuration. Or you can set the approval template on the Endpoint by assigning approval property to a reference onto a bean in the Registry.

You can also provide header values using the same approval.PropertyName in the incoming message headers.

And finally body can contain one AprovalRequest or an Iterable of ApprovalRequest objects to process as a batch.

The important thing to remember is the priority of the values specified in these three mechanisms:

  1. value in body takes precedence before any other
  2. value in message header takes precedence before template value
  3. value in template is set if no other value in header or body was given

For example to send one record for approval using values in headers use:

Given a route:

from("direct:example1")//
        .setHeader("approval.ContextId", simple("${body['contextId']}"))
        .setHeader("approval.NextApproverIds", simple("${body['nextApproverIds']}"))
        .to("salesforce:approval?"//
            + "approval.actionType=Submit"//
            + "&approval.comments=this is a test"//
            + "&approval.processDefinitionNameOrId=Test_Account_Process"//
            + "&approval.skipEntryCriteria=true");

You could send a record for approval using:

final Map<String, String> body = new HashMap<>();
body.put("contextId", accountIds.iterator().next());
body.put("nextApproverIds", userId);

final ApprovalResult result = template.requestBody("direct:example1", body, ApprovalResult.class);

289.8. Using Salesforce Recent Items API

To fetch the recent items use salesforce:recent operation. This operation returns an java.util.List of org.apache.camel.component.salesforce.api.dto.RecentItem objects (List<RecentItem>) that in turn contain the Id, Name and Attributes (with type and url properties). You can limit the number of returned items by specifying limit parameter set to maximum number of records to return. For example:

from("direct:fetchRecentItems")
    to("salesforce:recent")
        .split().body()
            .log("${body.name} at ${body.attributes.url}");

289.9. Working with approvals

All the properties are named exactly the same as in the Salesforce REST API prefixed with approval.. You can set approval properties by setting approval.PropertyName of the Endpoint these will be used as template — meaning that any property not present in either body or header will be taken from the Endpoint configuration. Or you can set the approval template on the Endpoint by assigning approval property to a reference onto a bean in the Registry.

You can also provide header values using the same approval.PropertyName in the incoming message headers.

And finally body can contain one AprovalRequest or an Iterable of ApprovalRequest objects to process as a batch.

The important thing to remember is the priority of the values specified in these three mechanisms:

  1. value in body takes precedence before any other
  2. value in message header takes precedence before template value
  3. value in template is set if no other value in header or body was given

For example to send one record for approval using values in headers use:

Given a route:

from("direct:example1")//
        .setHeader("approval.ContextId", simple("${body['contextId']}"))
        .setHeader("approval.NextApproverIds", simple("${body['nextApproverIds']}"))
        .to("salesforce:approval?"//
            + "approvalActionType=Submit"//
            + "&approvalComments=this is a test"//
            + "&approvalProcessDefinitionNameOrId=Test_Account_Process"//
            + "&approvalSkipEntryCriteria=true");

You could send a record for approval using:

final Map<String, String> body = new HashMap<>();
body.put("contextId", accountIds.iterator().next());
body.put("nextApproverIds", userId);

final ApprovalResult result = template.requestBody("direct:example1", body, ApprovalResult.class);

289.10. Using Salesforce Composite API to submit SObject tree

To create up to 200 records including parent-child relationships use salesforce:composite-tree operation. This requires an instance of org.apache.camel.component.salesforce.api.dto.composite.SObjectTree in the input message and returns the same tree of objects in the output message. The org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase instances within the tree get updated with the identifier values (Id property) or their corresponding org.apache.camel.component.salesforce.api.dto.composite.SObjectNode is populated with errors on failure.

Note that for some records operation can succeed and for some it can fail — so you need to manually check for errors.

Easiest way to use this functionality is to use the DTOs generated by the camel-salesforce-maven-plugin, but you also have the option of customizing the references that identify the each object in the tree, for instance primary keys from your database.

Lets look at an example:

Account account = ...
Contact president = ...
Contact marketing = ...

Account anotherAccount = ...
Contact sales = ...
Asset someAsset = ...

// build the tree
SObjectTree request = new SObjectTree();
request.addObject(account).addChildren(president, marketing);
request.addObject(anotherAccount).addChild(sales).addChild(someAsset);

final SObjectTree response = template.requestBody("salesforce:composite-tree", tree, SObjectTree.class);
final Map<Boolean, List<SObjectNode>> result = response.allNodes()
                                                   .collect(Collectors.groupingBy(SObjectNode::hasErrors));

final List<SObjectNode> withErrors = result.get(true);
final List<SObjectNode> succeeded = result.get(false);

final String firstId = succeeded.get(0).getId();

289.11. Using Salesforce Composite API to submit multiple requests in a batch

The Composite API batch operation (composite-batch) allows you to accumulate multiple requests in a batch and then submit them in one go, saving the round trip cost of multiple individual requests. Each response is then received in a list of responses with the order preserved, so that the n-th requests response is in the n-th place of the response.

Note

The results can vary from API to API so the result of the request is given as a java.lang.Object. In most cases the result will be a java.util.Map with string keys and values or other java.util.Map as value. Requests made in JSON format hold some type information (i.e. it is known what values are strings and what values are numbers), so in general those will be more type friendly. Note that the responses will vary between XML and JSON, this is due to the responses from Salesforce API being different. So be careful if you switch between formats without changing the response handling code.

Lets look at an example:

final String acountId = ...
final SObjectBatch batch = new SObjectBatch("38.0");

final Account updates = new Account();
updates.setName("NewName");
batch.addUpdate("Account", accountId, updates);

final Account newAccount = new Account();
newAccount.setName("Account created from Composite batch API");
batch.addCreate(newAccount);

batch.addGet("Account", accountId, "Name", "BillingPostalCode");

batch.addDelete("Account", accountId);

final SObjectBatchResponse response = template.requestBody("salesforce:composite-batch?format=JSON", batch, SObjectBatchResponse.class);

boolean hasErrors = response.hasErrors(); // if any of the requests has resulted in either 4xx or 5xx HTTP status
final List<SObjectBatchResult> results = response.getResults(); // results of three operations sent in batch

final SObjectBatchResult updateResult = results.get(0); // update result
final int updateStatus = updateResult.getStatusCode(); // probably 204
final Object updateResultData = updateResult.getResult(); // probably null

final SObjectBatchResult createResult = results.get(1); // create result
@SuppressWarnings("unchecked")
final Map<String, Object> createData = (Map<String, Object>) createResult.getResult();
final String newAccountId = createData.get("id"); // id of the new account, this is for JSON, for XML it would be createData.get("Result").get("id")

final SObjectBatchResult retrieveResult = results.get(2); // retrieve result
@SuppressWarnings("unchecked")
final Map<String, Object> retrieveData = (Map<String, Object>) retrieveResult.getResult();
final String accountName = retrieveData.get("Name"); // Name of the retrieved account, this is for JSON, for XML it would be createData.get("Account").get("Name")
final String accountBillingPostalCode = retrieveData.get("BillingPostalCode"); // Name of the retrieved account, this is for JSON, for XML it would be createData.get("Account").get("BillingPostalCode")

final SObjectBatchResult deleteResult = results.get(3); // delete result
final int updateStatus = deleteResult.getStatusCode(); // probably 204
final Object updateResultData = deleteResult.getResult(); // probably null

289.12. Using Salesforce Composite API to submit multiple chained requests

The composite operation allows submitting up to 25 requests that can be chained together, for instance identifier generated in previous request can be used in subsequent request. Individual requests and responses are linked with the provided reference.

Note

Composite API supports only JSON payloads.

Note

As with the batch API the results can vary from API to API so the result of the request is given as a java.lang.Object. In most cases the result will be a java.util.Map with string keys and values or other java.util.Map as value. Requests made in JSON format hold some type information (i.e. it is known what values are strings and what values are numbers), so in general those will be more type friendly.

Lets look at an example:

SObjectComposite composite = new SObjectComposite("38.0", true);

// first insert operation via an external id
final Account updateAccount = new TestAccount();
updateAccount.setName("Salesforce");
updateAccount.setBillingStreet("Landmark @ 1 Market Street");
updateAccount.setBillingCity("San Francisco");
updateAccount.setBillingState("California");
updateAccount.setIndustry(Account_IndustryEnum.TECHNOLOGY);
composite.addUpdate("Account", "001xx000003DIpcAAG", updateAccount, "UpdatedAccount");

final Contact newContact = new TestContact();
newContact.setLastName("John Doe");
newContact.setPhone("1234567890");
composite.addCreate(newContact, "NewContact");

final AccountContactJunction__c junction = new AccountContactJunction__c();
junction.setAccount__c("001xx000003DIpcAAG");
junction.setContactId__c("@{NewContact.id}");
composite.addCreate(junction, "JunctionRecord");

final SObjectCompositeResponse response = template.requestBody("salesforce:composite?format=JSON", composite, SObjectCompositeResponse.class);
final List<SObjectCompositeResult> results = response.getCompositeResponse();

final SObjectCompositeResult accountUpdateResult = results.stream().filter(r -> "UpdatedAccount".equals(r.getReferenceId())).findFirst().get()
final int statusCode = accountUpdateResult.getHttpStatusCode(); // should be 200
final Map<String, ?> accountUpdateBody = accountUpdateResult.getBody();

final SObjectCompositeResult contactCreationResult = results.stream().filter(r -> "JunctionRecord".equals(r.getReferenceId())).findFirst().get()

289.13. Generating SOQL query strings

org.apache.camel.component.salesforce.api.utils.QueryHelper contains helper methods to generate SOQL queries. For instance to fetch all custom fields from Account SObject you can simply generate the SOQL SELECT by invoking:

String allCustomFieldsQuery = QueryHelper.queryToFetchFilteredFieldsOf(new Account(), SObjectField::isCustom);

289.14. Camel Salesforce Maven Plugin

This Maven plugin generates DTOs for the Camel Salesforce.

For obvious security reasons it is recommended that the clientId, clientSecret, userName and password fields be not set in the pom.xml. The plugin should be configured for the rest of the properties, and can be executed using the following command:

mvn camel-salesforce:generate -DcamelSalesforce.clientId=<clientid> -DcamelSalesforce.clientSecret=<clientsecret> \
    -DcamelSalesforce.userName=<username> -DcamelSalesforce.password=<password>

The generated DTOs use Jackson and XStream annotations. All Salesforce field types are supported. Date and time fields are mapped to java.time.ZonedDateTime by default, and picklist fields are mapped to generated Java Enumerations.

289.15. Options

The Salesforce component supports 31 options, which are listed below.

NameDescriptionDefaultType

authenticationType (security)

Explicit authentication method to be used, one of USERNAME_PASSWORD, REFRESH_TOKEN or JWT. Salesforce component can auto-determine the authentication method to use from the properties set, set this property to eliminate any ambiguity.

 

AuthenticationType

loginConfig (security)

All authentication configuration in one nested bean, all properties set there can be set directly on the component as well

 

SalesforceLoginConfig

instanceUrl (security)

URL of the Salesforce instance used after authantication, by default received from Salesforce on successful authentication

 

String

loginUrl (security)

Required URL of the Salesforce instance used for authentication, by default set to https://login.salesforce.com

https://login.salesforce.com

String

clientId (security)

Required OAuth Consumer Key of the connected app configured in the Salesforce instance setup. Typically a connected app needs to be configured but one can be provided by installing a package.

 

String

clientSecret (security)

OAuth Consumer Secret of the connected app configured in the Salesforce instance setup.

 

String

keystore (security)

KeyStore parameters to use in OAuth JWT flow. The KeyStore should contain only one entry with private key and certificate. Salesforce does not verify the certificate chain, so this can easily be a selfsigned certificate. Make sure that you upload the certificate to the corresponding connected app.

 

KeyStoreParameters

refreshToken (security)

Refresh token already obtained in the refresh token OAuth flow. One needs to setup a web application and configure a callback URL to receive the refresh token, or configure using the builtin callback at https://login.salesforce.com/services/oauth2/success or https://test.salesforce.com/services/oauth2/success and then retrive the refresh_token from the URL at the end of the flow. Note that in development organizations Salesforce allows hosting the callback web application at localhost.

 

String

userName (security)

Username used in OAuth flow to gain access to access token. It’s easy to get started with password OAuth flow, but in general one should avoid it as it is deemed less secure than other flows.

 

String

password (security)

Password used in OAuth flow to gain access to access token. It’s easy to get started with password OAuth flow, but in general one should avoid it as it is deemed less secure than other flows. Make sure that you append security token to the end of the password if using one.

 

String

lazyLogin (security)

If set to true prevents the component from authenticating to Salesforce with the start of the component. You would generaly set this to the (default) false and authenticate early and be immediately aware of any authentication issues.

false

boolean

config (common)

Global endpoint configuration - use to set values that are common to all endpoints

 

SalesforceEndpoint Config

httpClientProperties (common)

Used to set any properties that can be configured on the underlying HTTP client. Have a look at properties of SalesforceHttpClient and the Jetty HttpClient for all available options.

 

Map

longPollingTransport Properties (common)

Used to set any properties that can be configured on the LongPollingTransport used by the BayeuxClient (CometD) used by the streaming api

 

Map

sslContextParameters (security)

SSL parameters to use, see SSLContextParameters class for all available options.

 

SSLContextParameters

useGlobalSslContext Parameters (security)

Enable usage of global SSL context parameters

false

boolean

httpProxyHost (proxy)

Hostname of the HTTP proxy server to use.

 

String

httpProxyPort (proxy)

Port number of the HTTP proxy server to use.

 

Integer

httpProxyUsername (security)

Username to use to authenticate against the HTTP proxy server.

 

String

httpProxyPassword (security)

Password to use to authenticate against the HTTP proxy server.

 

String

isHttpProxySocks4 (proxy)

If set to true the configures the HTTP proxy to use as a SOCKS4 proxy.

false

boolean

isHttpProxySecure (security)

If set to false disables the use of TLS when accessing the HTTP proxy.

true

boolean

httpProxyIncluded Addresses (proxy)

A list of addresses for which HTTP proxy server should be used.

 

Set

httpProxyExcluded Addresses (proxy)

A list of addresses for which HTTP proxy server should not be used.

 

Set

httpProxyAuthUri (security)

Used in authentication against the HTTP proxy server, needs to match the URI of the proxy server in order for the httpProxyUsername and httpProxyPassword to be used for authentication.

 

String

httpProxyRealm (security)

Realm of the proxy server, used in preemptive Basic/Digest authentication methods against the HTTP proxy server.

 

String

httpProxyUseDigest Auth (security)

If set to true Digest authentication will be used when authenticating to the HTTP proxy,otherwise Basic authorization method will be used

false

boolean

packages (common)

In what packages are the generated DTO classes. Typically the classes would be generated using camel-salesforce-maven-plugin. Set it if using the generated DTOs to gain the benefit of using short SObject names in parameters/header values.

 

String[]

queryLocator (common)

Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records.

 

String

jobType (common)

Gets information only about jobs matching the specified job type. Possible values are:

Classic Bulk API jobs (this includes both query jobs and ingest jobs).

V2Query Bulk API 2.0 query jobs.

V2Ingest Bulk API 2.0 ingest (upload and upsert) jobs.

 

String

resolveProperty Placeholders (advanced)

Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.

true

boolean

The Salesforce endpoint is configured using URI syntax:

salesforce:operationName:topicName

with the following path and query parameters:

289.15.1. Path Parameters (2 parameters):

NameDescriptionDefaultType

operationName

The operation to use. There are 59 enums and the value can be one of: getVersions, getResources, getGlobalObjects, getBasicInfo, getDescription, getSObject, createSObject, updateSObject, deleteSObject, getSObjectWithId, upsertSObject, deleteSObjectWithId, getBlobField, query, queryMore, queryAll, search, apexCall, recent, createJob, getJob, closeJob, abortJob, createBatch, getBatch, getAllBatches, getRequest, getResults, createBatchQuery, getQueryResultIds, getQueryResult, getRecentReports, getReportDescription, executeSyncReport, executeAsyncReport, getReportInstances, getReportResults, limits, approval, approvals, composite-tree, composite-batch, composite, bulk2GetAllJobs, bulk2CreateJob, bulk2GetJob, bulk2CreateBatch, bulk2CloseJob, bulk2AbortJob, bulk2DeleteJob, bulk2GetSuccessfulResults, bulk2GetFailedResults, bulk2GetUnprocessedRecords, bulk2CreateQueryJob, bulk2GetQueryJob, bulk2GetAllQueryJobs, bulk2GetQueryJobResults, bulk2AbortQueryJob, bulk2DeleteQueryJob

 

OperationName

topicName

The name of the topic to use

 

String

289.15.2. Query Parameters (46 parameters):

NameDescriptionDefaultType

apexMethod (common)

APEX method name

 

String

apexQueryParams (common)

Query params for APEX method

 

Map

apexUrl (common)

APEX method URL

 

String

apiVersion (common)

Salesforce API version, defaults to SalesforceEndpointConfig.DEFAULT_VERSION

 

String

backoffIncrement (common)

Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect.

 

long

batchId (common)

Bulk API Batch ID

 

String

contentType (common)

Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV

 

ContentType

defaultReplayId (common)

Default replayId setting if no value is found in initialReplayIdMap

 

Long

format (common)

Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON

 

PayloadFormat

httpClient (common)

Custom Jetty Http Client to use to connect to Salesforce.

 

SalesforceHttpClient

includeDetails (common)

Include details in Salesforce1 Analytics report, defaults to false.

 

Boolean

initialReplayIdMap (common)

Replay IDs to start from per channel name.

 

Map

instanceId (common)

Salesforce1 Analytics report execution instance ID

 

String

jobId (common)

Bulk API Job ID

 

String

jobType (common)

Gets information only about jobs matching the specified job type. Possible values are:

Classic Bulk API jobs (this includes both query jobs and ingest jobs).

V2Query Bulk API 2.0 query jobs.

V2Ingest Bulk API 2.0 ingest (upload and upsert) jobs.

 

String

limit (common)

Limit on number of returned records. Applicable to some of the API, check the Salesforce documentation.

 

Integer

maxBackoff (common)

Maximum backoff interval for Streaming connection restart attempts for failures beyond CometD auto-reconnect.

 

long

notFoundBehaviour (common)

Sets the behaviour of 404 not found status received from Salesforce API. Should the body be set to NULL NotFoundBehaviour#NULL or should a exception be signaled on the exchange NotFoundBehaviour#EXCEPTION - the default.

 

NotFoundBehaviour

notifyForFields (common)

Notify for fields, options are ALL, REFERENCED, SELECT, WHERE

 

NotifyForFieldsEnum

notifyForOperationCreate (common)

Notify for create operation, defaults to false (API version = 29.0)

 

Boolean

notifyForOperationDelete (common)

Notify for delete operation, defaults to false (API version = 29.0)

 

Boolean

notifyForOperations (common)

Notify for operations, options are ALL, CREATE, EXTENDED, UPDATE (API version 29.0)

 

NotifyForOperations Enum

notifyForOperationUndelete (common)

Notify for un-delete operation, defaults to false (API version = 29.0)

 

Boolean

notifyForOperationUpdate (common)

Notify for update operation, defaults to false (API version = 29.0)

 

Boolean

objectMapper (common)

Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects.

 

ObjectMapper

queryLocator (common)

Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records.

 

String

rawPayload (common)

Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default

false

boolean

reportId (common)

Salesforce1 Analytics report Id

 

String

reportMetadata (common)

Salesforce1 Analytics report metadata for filtering

 

ReportMetadata

resultId (common)

Bulk API Result ID

 

String

serializeNulls (common)

Should the NULL values of given DTO be serialized with empty (NULL) values. This affects only JSON data format.

false

boolean

sObjectBlobFieldName (common)

SObject blob field name

 

String

sObjectClass (common)

Fully qualified SObject class name, usually generated using camel-salesforce-maven-plugin

 

String

sObjectFields (common)

SObject fields to retrieve

 

String

sObjectId (common)

SObject ID if required by API

 

String

sObjectIdName (common)

SObject external ID field name

 

String

sObjectIdValue (common)

SObject external ID field value

 

String

sObjectName (common)

SObject name if required or supported by API

 

String

sObjectQuery (common)

Salesforce SOQL query string

 

String

sObjectSearch (common)

Salesforce SOSL search string

 

String

updateTopic (common)

Whether to update an existing Push Topic when using the Streaming API, defaults to false

false

boolean

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

boolean

replayId (consumer)

The replayId value to use when subscribing

 

Long

exceptionHandler (consumer)

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.

 

ExceptionHandler

exchangePattern (consumer)

Sets the exchange pattern when the consumer creates an exchange.

 

ExchangePattern

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

289.16. Spring Boot Auto-Configuration

The component supports 85 options, which are listed below.

NameDescriptionDefaultType

camel.component.salesforce.authentication-type

Explicit authentication method to be used, one of USERNAME_PASSWORD, REFRESH_TOKEN or JWT. Salesforce component can auto-determine the authentication method to use from the properties set, set this property to eliminate any ambiguity.

 

AuthenticationType

camel.component.salesforce.client-id

OAuth Consumer Key of the connected app configured in the Salesforce instance setup. Typically a connected app needs to be configured but one can be provided by installing a package.

 

String

camel.component.salesforce.client-secret

OAuth Consumer Secret of the connected app configured in the Salesforce instance setup.

 

String

camel.component.salesforce.config.apex-method

APEX method name

 

String

camel.component.salesforce.config.apex-query-params

Query params for APEX method

 

Map

camel.component.salesforce.config.apex-url

APEX method URL

 

String

camel.component.salesforce.config.api-version

Salesforce API version, defaults to SalesforceEndpointConfig.DEFAULT_VERSION

 

String

camel.component.salesforce.config.approval

The approval request for Approval API. @param approval

 

ApprovalRequest

camel.component.salesforce.config.approval-action-type

Represents the kind of action to take: Submit, Approve, or Reject. @param actionType

 

ApprovalRequest$Action

camel.component.salesforce.config.approval-comments

The comment to add to the history step associated with this request. @param comments

 

String

camel.component.salesforce.config.approval-context-actor-id

The ID of the submitter who’s requesting the approval record. @param contextActorId

 

String

camel.component.salesforce.config.approval-context-id

The ID of the item that is being acted upon. @param contextId

 

String

camel.component.salesforce.config.approval-next-approver-ids

If the process requires specification of the next approval, the ID of the user to be assigned the next request. @param nextApproverIds

 

List

camel.component.salesforce.config.approval-process-definition-name-or-id

The developer name or ID of the process definition. @param processDefinitionNameOrId

 

String

camel.component.salesforce.config.approval-skip-entry-criteria

Determines whether to evaluate the entry criteria for the process (true) or not (false) if the process definition name or ID isn’t null. If the process definition name or ID isn’t specified, this argument is ignored, and standard evaluation is followed based on process order. By default, the entry criteria isn’t skipped if it’s not set by this request. @param skipEntryCriteria

 

Boolean

camel.component.salesforce.config.backoff-increment

Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect.

 

Long

camel.component.salesforce.config.batch-id

Bulk API Batch ID

 

String

camel.component.salesforce.config.content-type

Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV

 

ContentType

camel.component.salesforce.config.default-replay-id

Default replayId setting if no value is found in initialReplayIdMap

 

Long

camel.component.salesforce.config.format

Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON

 

PayloadFormat

camel.component.salesforce.config.http-client

Custom Jetty Http Client to use to connect to Salesforce.

 

SalesforceHttpClient

camel.component.salesforce.config.include-details

Include details in Salesforce1 Analytics report, defaults to false.

 

Boolean

camel.component.salesforce.config.initial-replay-id-map

Replay IDs to start from per channel name.

 

Map

camel.component.salesforce.config.instance-id

Salesforce1 Analytics report execution instance ID

 

String

camel.component.salesforce.config.job-id

Bulk API Job ID

 

String

camel.component.salesforce.config.limit

Limit on number of returned records. Applicable to some of the API, check the Salesforce documentation.

 

Integer

camel.component.salesforce.config.max-backoff

Maximum backoff interval for Streaming connection restart attempts for failures beyond CometD auto-reconnect.

 

Long

camel.component.salesforce.config.not-found-behaviour

Sets the behaviour of 404 not found status received from Salesforce API. Should the body be set to NULL NotFoundBehaviour#NULL or should a exception be signaled on the exchange NotFoundBehaviour#EXCEPTION - the default.

 

NotFoundBehaviour

camel.component.salesforce.config.notify-for-fields

Notify for fields, options are ALL, REFERENCED, SELECT, WHERE

 

NotifyForFieldsEnum

camel.component.salesforce.config.notify-for-operation-create

Notify for create operation, defaults to false (API version = 29.0)

 

Boolean

camel.component.salesforce.config.notify-for-operation-delete

Notify for delete operation, defaults to false (API version = 29.0)

 

Boolean

camel.component.salesforce.config.notify-for-operation-undelete

Notify for un-delete operation, defaults to false (API version = 29.0)

 

Boolean

camel.component.salesforce.config.notify-for-operation-update

Notify for update operation, defaults to false (API version = 29.0)

 

Boolean

camel.component.salesforce.config.notify-for-operations

Notify for operations, options are ALL, CREATE, EXTENDED, UPDATE (API version 29.0)

 

NotifyForOperations Enum

camel.component.salesforce.config.object-mapper

Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects.

 

ObjectMapper

camel.component.salesforce.config.raw-payload

Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default

false

Boolean

camel.component.salesforce.config.report-id

Salesforce1 Analytics report Id

 

String

camel.component.salesforce.config.report-metadata

Salesforce1 Analytics report metadata for filtering

 

ReportMetadata

camel.component.salesforce.config.result-id

Bulk API Result ID

 

String

camel.component.salesforce.config.s-object-blob-field-name

SObject blob field name

 

String

camel.component.salesforce.config.s-object-class

Fully qualified SObject class name, usually generated using camel-salesforce-maven-plugin

 

String

camel.component.salesforce.config.s-object-fields

SObject fields to retrieve

 

String

camel.component.salesforce.config.s-object-id

SObject ID if required by API

 

String

camel.component.salesforce.config.s-object-id-name

SObject external ID field name

 

String

camel.component.salesforce.config.s-object-id-value

SObject external ID field value

 

String

camel.component.salesforce.config.s-object-name

SObject name if required or supported by API

 

String

camel.component.salesforce.config.s-object-query

Salesforce SOQL query string

 

String

camel.component.salesforce.config.s-object-search

Salesforce SOSL search string

 

String

camel.component.salesforce.config.serialize-nulls

Should the NULL values of given DTO be serialized with empty (NULL) values. This affects only JSON data format.

false

Boolean

camel.component.salesforce.config.update-topic

Whether to update an existing Push Topic when using the Streaming API, defaults to false

false

Boolean

camel.component.salesforce.enabled

Enable salesforce component

true

Boolean

camel.component.salesforce.http-client-properties

Used to set any properties that can be configured on the underlying HTTP client. Have a look at properties of SalesforceHttpClient and the Jetty HttpClient for all available options.

 

Map

camel.component.salesforce.http-proxy-auth-uri

Used in authentication against the HTTP proxy server, needs to match the URI of the proxy server in order for the httpProxyUsername and httpProxyPassword to be used for authentication.

 

String

camel.component.salesforce.http-proxy-excluded-addresses

A list of addresses for which HTTP proxy server should not be used.

 

Set

camel.component.salesforce.http-proxy-host

Hostname of the HTTP proxy server to use.

 

String

camel.component.salesforce.http-proxy-included-addresses

A list of addresses for which HTTP proxy server should be used.

 

Set

camel.component.salesforce.http-proxy-password

Password to use to authenticate against the HTTP proxy server.

 

String

camel.component.salesforce.http-proxy-port

Port number of the HTTP proxy server to use.

 

Integer

camel.component.salesforce.http-proxy-realm

Realm of the proxy server, used in preemptive Basic/Digest authentication methods against the HTTP proxy server.

 

String

camel.component.salesforce.http-proxy-use-digest-auth

If set to true Digest authentication will be used when authenticating to the HTTP proxy,otherwise Basic authorization method will be used

false

Boolean

camel.component.salesforce.http-proxy-username

Username to use to authenticate against the HTTP proxy server.

 

String

camel.component.salesforce.instance-url

URL of the Salesforce instance used after authantication, by default received from Salesforce on successful authentication

 

String

camel.component.salesforce.is-http-proxy-secure

If set to false disables the use of TLS when accessing the HTTP proxy.

true

Boolean

camel.component.salesforce.is-http-proxy-socks4

If set to true the configures the HTTP proxy to use as a SOCKS4 proxy.

false

Boolean

camel.component.salesforce.keystore

KeyStore parameters to use in OAuth JWT flow. The KeyStore should contain only one entry with private key and certificate. Salesforce does not verify the certificate chain, so this can easily be a selfsigned certificate. Make sure that you upload the certificate to the corresponding connected app. The option is a org.apache.camel.util.jsse.KeyStoreParameters type.

 

String

camel.component.salesforce.lazy-login

If set to true prevents the component from authenticating to Salesforce with the start of the component. You would generaly set this to the (default) false and authenticate early and be immediately aware of any authentication issues.

false

Boolean

camel.component.salesforce.login-config.client-id

Salesforce connected application Consumer Key

 

String

camel.component.salesforce.login-config.client-secret

Salesforce connected application Consumer Secret

 

String

camel.component.salesforce.login-config.instance-url

  

String

camel.component.salesforce.login-config.keystore

Keystore parameters for keystore containing certificate and private key needed for OAuth 2.0 JWT Bearer Token Flow.

 

KeyStoreParameters

camel.component.salesforce.login-config.lazy-login

Flag to enable/disable lazy OAuth, default is false. When enabled, OAuth token retrieval or generation is not done until the first API call

 

Boolean

camel.component.salesforce.login-config.login-url

Salesforce login URL, defaults to https://login.salesforce.com

 

String

camel.component.salesforce.login-config.password

Salesforce account password

 

String

camel.component.salesforce.login-config.refresh-token

Salesforce connected application Consumer token

 

String

camel.component.salesforce.login-config.type

  

AuthenticationType

camel.component.salesforce.login-config.user-name

Salesforce account user name

 

String

camel.component.salesforce.login-url

URL of the Salesforce instance used for authentication, by default set to https://login.salesforce.com

https://login.salesforce.com

String

camel.component.salesforce.long-polling-transport-properties

Used to set any properties that can be configured on the LongPollingTransport used by the BayeuxClient (CometD) used by the streaming api

 

Map

camel.component.salesforce.packages

In what packages are the generated DTO classes. Typically the classes would be generated using camel-salesforce-maven-plugin. Set it if using the generated DTOs to gain the benefit of using short SObject names in parameters/header values.

 

String[]

camel.component.salesforce.password

Password used in OAuth flow to gain access to access token. It’s easy to get started with password OAuth flow, but in general one should avoid it as it is deemed less secure than other flows. Make sure that you append security token to the end of the password if using one.

 

String

camel.component.salesforce.refresh-token

Refresh token already obtained in the refresh token OAuth flow. One needs to setup a web application and configure a callback URL to receive the refresh token, or configure using the builtin callback at https://login.salesforce.com/services/oauth2/success or https://test.salesforce.com/services/oauth2/success and then retrive the refresh_token from the URL at the end of the flow. Note that in development organizations Salesforce allows hosting the callback web application at localhost.

 

String

camel.component.salesforce.resolve-property-placeholders

Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.

true

Boolean

camel.component.salesforce.ssl-context-parameters

SSL parameters to use, see SSLContextParameters class for all available options. The option is a org.apache.camel.util.jsse.SSLContextParameters type.

 

String

camel.component.salesforce.use-global-ssl-context-parameters

Enable usage of global SSL context parameters

false

Boolean

camel.component.salesforce.user-name

Username used in OAuth flow to gain access to access token. It’s easy to get started with password OAuth flow, but in general one should avoid it as it is deemed less secure than other flows.

 

String

Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.