Camel Components

Salesforce

Since Camel 2.12

Both producer and consumer are supported

This component supports producer and consumer endpoints to communicate with Salesforce using Java DTOs. There is a companion maven plugin that generates these DTOs.

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

Getting Started

Follow these steps to get started with the Salesforce component.

  1. Create a salesforce org. If you don’t already have access to a salesforce org, you can create a free developer org.

  2. Create a Connected App. In salesforce, go to Setup > Apps > App Manager, then click on New Connected App. Make sure to check Enable OAuth Settings and include relevant OAuth Scopes, including the scope called Perform requests at any time. Click Save.

  3. Get the Consumer Key and Consumer Secret. You’ll need these to configure salesforce authentication. View your new connected app, then copy the key and secret and save in a safe place.

  4. Add Maven dependency.

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-salesforce</artifactId>
    </dependency>

    Spring Boot users should use the starter instead.

    <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-salesforce-starter</artifactId>
    </dependency>
  5. Generate DTOs. Optionally, generate Java DTOs to represent your salesforce objects. This step isn’t a hard requirement per se, but most use cases will benefit from the type safety and auto-completion. Use the maven plugin to generate DTOs for the salesforce objects you’ll be working with.

  6. Configure authentication. Using the OAuth key and secret, you generated previously, configure salesforce authentication.

  7. Create routes. Starting creating routes that interact with salesforce!

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.

Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.

A good practice when configuring options is to use Property Placeholders.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component Options

The Salesforce component supports the following options which are listed below.

Name Description Default Type

apexMethod (common)

HTTP verb used for the Apex REST invocation, such as GET, POST, PUT, PATCH or DELETE. Applies to the apexCall operation and defaults to GET. Can be overridden per message with the CamelSalesforceApexMethod header.

GET

String

apexQueryParams (common)

Query parameters to add to the URL of the apexCall operation. The other unknown parameters of an apexCall endpoint URI are added too, a header named CamelSalesforceApexQueryParam. followed by the parameter name adds or overrides one, and a Map body adds its entries.

Map

apiVersion (common)

Salesforce API version, such as 56.0, used in the URLs of the REST, Bulk, Composite and Analytics API calls. The subscribe consumer needs 24.0 or newer and connects to the Streaming API with the version set on the component; getEventSchema needs 40.0 or newer.

56.0

String

backoffIncrement (common)

Amount, in milliseconds, by which the delay between reconnection attempts grows. For the subscribe consumer (Streaming API), the delay before each handshake or subscribe retry starts at 0; this consumer uses the value set on the component. For the pubSubSubscribe consumer, the delay before subscribing again after an error starts at this value. Login retries use it too.

1000

long

batchId (common)

Identifies a batch within a Bulk API v1 job. Required by getBatch, getRequest, getResults, getQueryResultIds and getQueryResult unless a BatchInfo message body supplies it. Not used by Bulk API 2.0.

String

contentType (common)

Content type of the batch data of the Bulk API v1 createBatch operation, and of createBatchQuery when the body is not a JobInfo: XML, CSV, ZIP_XML or ZIP_CSV (no Content-Type is mapped for JSON and ZIP_JSON). Can be set per message with the CamelSalesforceContentType header.

Enum values:

  • XML

  • CSV

  • JSON

  • ZIP_XML

  • ZIP_CSV

  • ZIP_JSON

ContentType

defaultReplayId (common)

Replay id the subscribe consumer starts from when neither replayId nor initialReplayIdMap gives one for the channel: -1 receives only new events, -2 all the events Salesforce still retains.

-1

Long

fallBackReplayId (common)

Replay id the subscribe consumer subscribes again with when Salesforce rejects the replay id as invalid, for example because it is too old: -1 for new events only, -2 for all retained events.

-1

Long

format (common)

Payload format of the raw operation, JSON or XML: it sets the Accept and Content-Type headers of the request, unless rawHttpHeaders gives them. The other operations ignore it.

Enum values:

  • JSON

  • XML

PayloadFormat

httpClient (common)

Custom SalesforceHttpClient (a Jetty HTTP client) to use. Set on the component, it replaces the client the component creates; set on an endpoint, only the Bulk, Bulk 2.0, Analytics, Composite and SObject Collections operations use it.

SalesforceHttpClient

httpClientConnectionTimeout (common)

Timeout in milliseconds for the Jetty HttpClient to open a connection to the Salesforce server (or to the proxy). 0 means no timeout.

60000

long

httpClientIdleTimeout (common)

Idle timeout in milliseconds of the connections of the Jetty HttpClient: a connection on which no bytes are sent or received for this long is closed, which fails a request that is still waiting for its response. 0 means no idle timeout. The Streaming API long polling requests are not subject to it.

10000

long

httpMaxContentLength (common)

Maximum size in bytes of the body of a Salesforce API response, which the component buffers in memory; a larger response fails. When not set, 4194304 (4 MB) is used.

Integer

httpRequestBufferSize (common)

Size in bytes of the buffer that the Jetty HttpClient writes the request line and headers into; a larger value also raises the maximum size of the request headers. Increase it for long SOQL queries, which are sent in the URL.

8192

Integer

httpRequestTimeout (common)

Total timeout in milliseconds of each request and response exchange of the Salesforce REST, Bulk, Composite, Analytics and raw API calls, and of the login and logout requests. 0 or a negative value means no timeout. It does not apply to the Streaming API and Pub/Sub API.

60000

long

includeDetails (common)

Whether executeSyncReport and executeAsyncReport return the detail rows of the report as well as the summary (the includeDetails parameter). When not set, the parameter is not sent and the Salesforce default (false) applies. Can be set per message with the CamelSalesforceIncludeDetails header.

Boolean

initialReplayIdMap (common)

Replay ids that the subscribe consumer starts from, per channel, keyed by topic name or channel name (such as /topic/MyTopic or /event/Order_Event__e). They take precedence over defaultReplayId, and replayId takes precedence over them.

Map

instanceId (common)

Id of the report instance whose results getReportResults returns, as returned by executeAsyncReport. Can be set per message with the CamelSalesforceInstanceId header.

String

jobId (common)

Identifies the Bulk API job to act on, for Bulk API v1 operations such as getJob, closeJob, abortJob, createBatch and getResults, and for the bulk2 operations that target an existing job. Operations that accept a JobInfo or BatchInfo message body can take the id from there instead.

String

limit (common)

Maximum number of items that the recent operation returns (the limit parameter). Can be set per message with the CamelSalesforceLimit header or the body.

Integer

locator (common)

Locator of the next set of results of a Bulk API 2.0 query job for bulk2GetQueryJobResults, from the Sforce-Locator header of the previous response (which the producer copies into the message headers). Can be set per message with the CamelSalesforceLocator header.

String

maxBackoff (common)

Upper limit, in milliseconds, of the delay between reconnection attempts. The subscribe consumer (Streaming API) stops retrying the handshake or subscription once the delay exceeds it; this consumer uses the value set on the component. The pubSubSubscribe consumer keeps retrying with at most this delay. Login retries wait at most this long.

30000

long

maxRecords (common)

Maximum number of records per set of results that bulk2GetQueryJobResults returns (the maxRecords parameter); when not set, Salesforce decides. A smaller value avoids timeouts with very large results; get the next set with locator. Can be set per message with the CamelSalesforceMaxRecords header.

Integer

notFoundBehaviour (common)

What the REST operations, such as getSObject, getSObjectWithId, query and apexCall, do when Salesforce answers 404 Not Found: EXCEPTION fails the exchange with a NoSuchSObjectException, NULL sets the message body to null.

Enum values:

  • EXCEPTION

  • NULL

EXCEPTION

NotFoundBehaviour

notifyForFields (common)

NotifyForFields of the PushTopic that the subscribe consumer creates or updates: which fields Salesforce evaluates to decide whether a change matches the query, ALL, REFERENCED, SELECT or WHERE. When not set, the Salesforce default applies.

Enum values:

  • ALL

  • REFERENCED

  • SELECT

  • WHERE

NotifyForFieldsEnum

notifyForOperationCreate (common)

Whether creating a record generates a notification: the NotifyForOperationCreate field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

notifyForOperationDelete (common)

Whether deleting a record generates a notification: the NotifyForOperationDelete field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

notifyForOperations (common)

NotifyForOperations of the PushTopic that the subscribe consumer creates or updates: ALL, CREATE, EXTENDED or UPDATE. Only for API versions before 29.0; with 29.0 or newer it fails the start of the consumer, use the notifyForOperation options instead.

Enum values:

  • ALL

  • CREATE

  • EXTENDED

  • UPDATE

NotifyForOperationsEnum

notifyForOperationUndelete (common)

Whether undeleting a record generates a notification: the NotifyForOperationUndelete field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

notifyForOperationUpdate (common)

Whether updating a record generates a notification: the NotifyForOperationUpdate field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

objectMapper (common)

Custom Jackson ObjectMapper to marshal and unmarshal the JSON of the REST, Composite, SObject Collections and Bulk 2.0 operations and of the subscribe consumer, for example to register more modules.

ObjectMapper

packages (common)

Comma-separated list of Java packages to scan for the DTO classes generated by camel-salesforce-maven-plugin, so that an SObject name given in sObjectName or in a header maps to its DTO class. Without it, give the DTO class with sObjectClass, or use rawPayload=true.

String

pkChunking (common)

Whether the Bulk API v1 operations send the Sforce-Enable-PKChunking header, so that Salesforce splits a bulk query job on the record ids into several batches. Salesforce acts on it when createJob creates the job. Bulk API 2.0 does PK chunking by itself. Can be set per message with the CamelSalesforcePkChunking header.

false

Boolean

pkChunkingChunkSize (common)

Number of records per chunk with pkChunking, sent as chunkSize in the Sforce-Enable-PKChunking header. Salesforce defaults to 100,000 and allows up to 250,000.

Integer

pkChunkingParent (common)

Parent object for pkChunking of a query on a sharing object, sent as parent in the Sforce-Enable-PKChunking header: the chunks are based on the records of the parent object, for example Account for AccountShare.

String

pkChunkingStartRow (common)

15-character or 18-character record id to use as the lower boundary of the first chunk with pkChunking, sent as startRow in the Sforce-Enable-PKChunking header, for example to restart a job that failed between batches.

String

queryLocator (common)

Query locator of the next page of jobs for bulk2GetAllJobs and bulk2GetAllQueryJobs: the queryLocator value in the nextRecordsUrl of the previous result, when its done property is false. Can be set per message with the CamelSalesforceQueryLocator header.

String

rawPayload (common)

Whether to work with the JSON as is instead of DTOs. The REST, apexCall and composite operations give the response as an InputStream (composite then also sends the body as is), and the subscribe consumer gives the message as JSON text: the sObject of a PushTopic event, or the whole message of a platform or change event.

false

boolean

reportId (common)

Id of the report for the Analytics API operations getReportDescription, executeSyncReport, executeAsyncReport, getReportInstances and getReportResults. When neither this option nor the CamelSalesforceReportId header is set, the body is used, or the id of a ReportMetadata body for the execute operations.

String

reportMetadata (common)

Report metadata, such as filters, to run executeSyncReport or executeAsyncReport with, instead of the saved settings of the report. A ReportMetadata body takes precedence. Can be set per message with the CamelSalesforceReportMetadata header.

ReportMetadata

resultId (common)

Identifies one result set of a completed Bulk API v1 query batch, as returned by the getQueryResultIds operation. Used only by getQueryResult, together with jobId and batchId.

String

sObjectBlobFieldName (common)

Name of the blob field that getBlobField downloads, such as Body of an Attachment or VersionData of a ContentVersion. Can be set per message with the CamelSalesforceSObjectBlobFieldName header.

String

sObjectClass (common)

Fully qualified name of the DTO class to unmarshal the response to, usually generated by the camel-salesforce-maven-plugin; for query, queryAll and queryMore a QueryRecords class. Used by the SObject, query, apexCall and compositeRetrieveSObjectCollections operations, and by the subscribe consumer for PushTopic records. When neither this nor sObjectName is set, the producer looks up the class in packages by the type in the response. Can be set per message with the CamelSalesforceSObjectClass header.

String

sObjectFields (common)

Comma-separated list of the fields to return: for getSObject (all fields when not set), and for compositeRetrieveSObjectCollections, which requires it. Can be set per message with the CamelSalesforceSObjectFields header.

String

sObjectId (common)

Id of the record for getSObject, updateSObject, deleteSObject and getBlobField. When the body is a DTO, its Id field is used instead; when neither this option nor the CamelSalesforceSObjectId header is set, the body is the id.

String

sObjectIdName (common)

Name of the external ID field that identifies the record, for getSObjectWithId, upsertSObject, deleteSObjectWithId and compositeUpsertSObjectCollections. Can be set per message with the CamelSalesforceSObjectIdName header.

String

sObjectIdValue (common)

Value of the external ID field (sObjectIdName) that identifies the record, for getSObjectWithId, upsertSObject and deleteSObjectWithId. When the body is a DTO, the value of that field in the DTO is used; otherwise this option, the CamelSalesforceSObjectIdValue header or, except for upsertSObject, the body.

String

sObjectName (common)

Name of the SObject, such as Account or Merchandise__c, for the SObject operations (such as getSObject, createSObject, upsertSObject, getBasicInfo and getDescription) and the SObject Collections operations. It also selects the DTO class of that name in packages to unmarshal the response to, and for the subscribe consumer the class of the PushTopic records. When not set, the simple class name of a DTO body is used. Can be set per message with the CamelSalesforceSObjectName header.

String

sObjectQuery (common)

SOQL query for query, queryAll and the Bulk API v1 createBatchQuery; for queryMore, the nextRecordsUrl of the previous result. When neither this option nor the CamelSalesforceSObjectQuery header is set, the producer uses the body. For the subscribe consumer, the query of the PushTopic to create or update.

String

sObjectSearch (common)

SOSL search for the search operation. When neither this option nor the CamelSalesforceSObjectSearch header is set, the body is used.

String

streamQueryResult (common)

Whether query and queryAll give an Iterator over all the matching records instead of one page of results: the following pages are fetched while iterating. Also sets the CamelSalesforceQueryResultTotalSize header. Can be set per message with the CamelSalesforceStreamQueryResult header.

false

Boolean

updateTopic (common)

Whether the subscribe consumer updates an existing PushTopic whose query or notifyFor* settings differ from those of the endpoint. When false, such a difference fails the start of the consumer. Only used when sObjectQuery is set.

false

boolean

config (common (advanced))

Endpoint configuration shared by all the endpoints of this component: each endpoint starts from a copy of it, and the options in the endpoint URI override its values.

SalesforceEndpointConfig

httpClientProperties (common (advanced))

Bean properties to set on the HTTP client of the component (a SalesforceHttpClient, which is a Jetty HttpClient), for example maxConnectionsPerDestination or followRedirects. It also takes the timeout, size and proxy settings under the keys of the HTTP_ constants of SalesforceComponent (such as httpIdleTimeout or httpProxyHost), which take precedence over the component options.

Map

longPollingTransportProperties (common (advanced))

Options of the CometD client transport (JettyHttpClientTransport) of the Streaming API (subscribe) consumers, for example maxNetworkDelay (120000 ms by default here) or maxMessageSize.

Map

workerPoolMaxSize (common (advanced))

Maximum number of threads of the pool on which the HTTP client that the component creates runs the response callbacks of the Salesforce API calls, the login retries and the Streaming API (CometD) listeners. Not used when a custom httpClient is set.

20

int

workerPoolSize (common (advanced))

Core number of threads of the pool on which the HTTP client that the component creates runs the response callbacks of the Salesforce API calls, the login retries and the Streaming API (CometD) listeners. Not used when a custom httpClient is set.

10

int

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. 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

fallbackToLatestReplayId (consumer)

What the pubSubSubscribe consumer does when Salesforce rejects the replay id as corrupted. When true, it subscribes again with the LATEST preset, so the events in between are skipped. When false, it passes an InvalidReplayIdException to the exception handler of the consumer (use bridgeErrorHandler to handle it in the route) and does not subscribe again.

false

boolean

pubSubBatchSize (consumer)

Number of events the pubSubSubscribe consumer asks for in each FetchRequest (num_requested); after each response it asks for more, to keep this many requested. Salesforce accepts at most 100.

100

int

pubSubDeserializeType (consumer)

How the pubSubSubscribe consumer turns the Avro payload of an event into the message body. AVRO gives a SpecificRecord when a generated class named after the schema is in the com.sforce.eventbus package, otherwise a GenericRecord; SPECIFIC_RECORD always that SpecificRecord class; GENERIC_RECORD a GenericRecord; POJO an object of pubSubPojoClass, read with Avro reflection; JSON the event as JSON text.

Enum values:

  • AVRO

  • SPECIFIC_RECORD

  • GENERIC_RECORD

  • POJO

  • JSON

AVRO

PubSubDeserializeType

pubSubPojoClass (consumer)

Fully qualified name of the class that the pubSubSubscribe consumer reads events into, with Avro reflection, when pubSubDeserializeType is POJO.

String

replayPreset (consumer)

Where the pubSubSubscribe consumer starts in the event stream: LATEST receives only new events, EARLIEST all the events Salesforce still retains, CUSTOM the events after pubSubReplayId, which it requires. After an error, the consumer subscribes again after the last event it received.

Enum values:

  • LATEST

  • EARLIEST

  • CUSTOM

LATEST

ReplayPreset

consumerWorkerPoolEnabled (consumer (advanced))

Whether the subscribe and pubSubSubscribe consumers hand each received event to a thread pool, so that events are routed in parallel (and can complete out of order), instead of routing them on the thread that received them. Each consumer creates its own pool of consumerWorkerPoolSize to consumerWorkerPoolMaxSize threads. Default for the endpoints of this component.

false

boolean

consumerWorkerPoolExecutorService (consumer (advanced))

Thread pool that the subscribe and pubSubSubscribe consumers hand each received event to, so that events are routed in parallel. It is used even when consumerWorkerPoolEnabled is false, and Camel does not shut it down. Default for the endpoints of this component.

ExecutorService

consumerWorkerPoolMaxSize (consumer (advanced))

Maximum number of threads of the pool that each subscribe or pubSubSubscribe consumer creates when consumerWorkerPoolEnabled is true. Default for the endpoints of this component.

20

int

consumerWorkerPoolSize (consumer (advanced))

Core number of threads of the pool that each subscribe or pubSubSubscribe consumer creates when consumerWorkerPoolEnabled is true. Default for the endpoints of this component.

10

int

initialReplyIdTimeout (consumer (advanced))

Deprecated: has no effect, as nothing reads it. It was the time in seconds to validate a custom pubSubReplayId when a Pub/Sub API consumer starts.

30

int

allOrNone (producer)

Whether the SObject Collections operations (compositeCreateSObjectCollections, compositeUpdateSObjectCollections, compositeUpsertSObjectCollections and compositeDeleteSObjectCollections) roll back the whole request when one record fails. The composite, composite-batch and composite-tree operations do not use it. Can be set per message with the CamelSalesforceAllOrNone header.

false

boolean

apexUrl (producer)

Path of the Apex REST resource to invoke, appended to /services/apexrest/ on the instance URL, for example MyApexClass/. The apexCall operation needs this value, which can be given as this option, in the endpoint path as apexCall/MyApexClass/, or in the CamelSalesforceApexUrl header. Placeholders written in curly braces are resolved from message headers of the same name.

String

approval (producer)

The approval request for the Salesforce Approval API. Options approval.actionType, approval.comments, approval.contextActorId, approval.contextId, approval.nextApproverIds, approval.processDefinitionNameOrId, approval.skipEntryCriteria are bound as nested properties.

ApprovalRequest

compositeMethod (producer)

HTTP method of the composite operation when rawPayload is true, for example GET; defaults to POST. Can be set per message with the CamelSalesforceCompositeMethod header.

String

eventName (producer)

Name of the platform event or change event, such as Order_Event__e or AccountChangeEvent, whose schema getEventSchema returns. Can be set per message with the CamelSalesforceEventName header.

String

eventSchemaFormat (producer)

Format of the schema that getEventSchema returns: EXPANDED (Apache Avro, but not strict about the record complex type) or COMPACT (follows the Apache Avro specification of the record complex type). EXPANDED is sent when not set; Salesforce accepts this parameter from API version 43.0. Can be set per message with the CamelSalesforceEventSchemaFormat header.

Enum values:

  • EXPANDED

  • COMPACT

EventSchemaFormatEnum

eventSchemaId (producer)

Id of the event schema that getEventSchema returns, used when eventName is not set. Can be set per message with the CamelSalesforceEventSchemaId header.

String

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

rawHttpHeaders (producer)

Comma-separated names of the message headers that the raw operation sends as HTTP headers, for example to set Accept or Content-Type.

String

rawMethod (producer)

HTTP method of the raw operation, such as GET, POST, PATCH or DELETE. Can be set per message with the CamelSalesforceRawMethod header.

String

rawPath (producer)

Path of the request of the raw operation, appended to the instance URL, for example /services/data/v56.0/sobjects/Account/. Can be set per message with the CamelSalesforceRawPath header.

String

rawQueryParameters (producer)

Comma-separated names of the message headers that the raw operation sends as query parameters of the same name. The values are URL-encoded, so do not encode them. A missing header fails the request.

String

autowiredEnabled (advanced)

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

boolean

httpProxyExcludedAddresses (proxy)

Destinations not to send through the proxy, each a host or host:port that must match the destination exactly (no wildcards). An excluded destination is not proxied even when it is also included.

Set

httpProxyHost (proxy)

Host name of the HTTP (or SOCKS4) proxy that the Jetty HttpClient connects through. The proxy is used only when httpProxyPort is set as well. It does not apply to the Pub/Sub API.

String

httpProxyIncludedAddresses (proxy)

Destinations to send through the proxy, each a host or host:port that must match the destination exactly (no wildcards). When empty, every destination goes through the proxy, except the excluded ones.

Set

httpProxyPort (proxy)

Port of the HTTP (or SOCKS4) proxy. The proxy is used only when httpProxyHost is set as well.

Integer

httpProxySocks4 (proxy)

If true, the proxy is a SOCKS4 proxy instead of an HTTP proxy.

false

boolean

pubsubAllowUseSystemProxy (proxy)

Whether the Pub/Sub API gRPC client may connect through the proxy that the default java.net.ProxySelector of the JVM returns for the Pub/Sub host (for example from the https.proxyHost and https.proxyPort system properties). If false, it connects directly. The httpProxy options do not apply to the Pub/Sub API.

true

boolean

authenticationType (security)

OAuth 2.0 flow to log in with: USERNAME_PASSWORD (needs userName, password and clientSecret), REFRESH_TOKEN (refreshToken), JWT (userName and keystore) or CLIENT_CREDENTIALS (clientSecret); each also needs clientId. When not set, the flow is chosen from the options that are set: password, refreshToken or keystore, or else clientId with clientSecret for CLIENT_CREDENTIALS; the login fails if more than one of password, refreshToken and keystore is set.

Enum values:

  • USERNAME_PASSWORD

  • REFRESH_TOKEN

  • CLIENT_CREDENTIALS

  • JWT

AuthenticationType

clientId (security)

Required Consumer key (the OAuth client_id) of the Salesforce connected app to log in with. Every authentication flow sends it, and the JWT flow also uses it as the issuer (iss) of the JWT assertion.

String

clientSecret (security)

Consumer secret (the OAuth client_secret) of the Salesforce connected app. Required by the USERNAME_PASSWORD and CLIENT_CREDENTIALS flows; the REFRESH_TOKEN flow sends it only when it is set, and the JWT flow does not use it.

String

httpProxyAuthUri (security)

URI of the proxy that the proxy credentials apply to: the Jetty HttpClient sends them only to a proxy with the same scheme, host and port, so give http://host:port, or https://host:port when httpProxySecure is true, without a path. Required when httpProxyUsername and httpProxyPassword are set.

String

httpProxyPassword (security)

Password to authenticate to the proxy with, used together with httpProxyUsername.

String

httpProxyRealm (security)

Realm that the proxy credentials apply to: it must match the realm in the Basic or Digest challenge (the Proxy-Authenticate header) of the proxy. The credentials are sent in answer to that challenge, not preemptively. Required when httpProxyUsername and httpProxyPassword are set.

String

httpProxySecure (security)

Whether the connection to the proxy itself uses TLS. Set it to false for a proxy that accepts plain (non-TLS) connections; the connections to Salesforce through the proxy use TLS either way.

true

boolean

httpProxyUseDigestAuth (security)

If true, the proxy credentials are used for Digest authentication, otherwise for Basic authentication.

false

boolean

httpProxyUsername (security)

User name to authenticate to the proxy with, used together with httpProxyPassword. Both httpProxyAuthUri and httpProxyRealm are then required.

String

instanceUrl (security)

Base URL of the Salesforce instance (org) to send the API calls to, for example https://mydomain.my.salesforce.com. When not set, the instance_url that Salesforce returns in the OAuth token response at login is used.

String

jwtAudience (security)

Audience (aud) claim of the JWT assertion in the OAuth 2.0 JWT bearer flow. When not set, the loginUrl is used; set it when the authorization server expects another audience, for example https://login.salesforce.com or https://test.salesforce.com when loginUrl is a My Domain URL.

String

keystore (security)

KeyStore with the private key that signs the JWT assertion (RS256) in the OAuth 2.0 JWT bearer flow (JWT). The KeyStore must hold exactly one private key entry, whose key password is the KeyStore password. Upload the matching certificate (a self-signed one is fine) to the connected app.

KeyStoreParameters

lazyLogin (security)

If true, the component neither checks the login options nor logs in to Salesforce when it starts; it logs in when a producer processes its first message, so login problems only show up then. The subscribe and pubSubSubscribe consumers fail to start when this is true.

false

boolean

loginConfig (security)

All the login options in one SalesforceLoginConfig bean: loginUrl, instanceUrl, clientId, clientSecret, userName, password, refreshToken, keystore, jwtAudience, authenticationType (its type property) and lazyLogin. When it is set, the component options of the same names are ignored.

SalesforceLoginConfig

loginUrl (security)

Required URL of the Salesforce OAuth 2.0 authorization server to log in at: the component posts the token request to this URL followed by /services/oauth2/token. Use https://test.salesforce.com for a sandbox, or the My Domain URL of the org. A trailing slash is removed. It is also the audience of the JWT assertion when jwtAudience is not set.

https://login.salesforce.com

String

password (security)

Password of the Salesforce user for the OAuth 2.0 username-password flow (USERNAME_PASSWORD). If the user has a security token, append it to the password. Salesforce advises against this flow, as it passes the credentials in the request; prefer the JWT, refresh token or client credentials flow.

String

pubSubHost (security)

Host name of the Salesforce Pub/Sub API gRPC service used by the pubSubSubscribe and pubSubPublish operations. Give a bare host name, without scheme or port.

api.pubsub.salesforce.com

String

pubSubPort (security)

TCP port of the Salesforce Pub/Sub API gRPC service used by the pubSubSubscribe and pubSubPublish operations.

7443

int

refreshToken (security)

Refresh token for the OAuth 2.0 refresh token flow (REFRESH_TOKEN), which the component exchanges for an access token at each login. Obtain it beforehand with an OAuth flow of the connected app that has the refresh_token (offline_access) scope, for example with the callback URL https://login.salesforce.com/services/oauth2/success (https://test.salesforce.com/services/oauth2/success for a sandbox), which shows the refresh_token in its URL at the end of the flow.

String

sslContextParameters (security)

TLS configuration of the HTTP client that the component creates, which logs in and calls the REST, Bulk and Streaming APIs. When not set, the global SSLContextParameters are used if useGlobalSslContextParameters is true, otherwise the default trust store of the JVM. It does not apply to the Pub/Sub API, nor to a custom httpClient.

SSLContextParameters

useGlobalSslContextParameters (security)

Whether the HTTP client that the component creates uses the global SSLContextParameters of the CamelContext when sslContextParameters is not set.

false

boolean

userName (security)

User name of the Salesforce user to log in as: the username of the OAuth 2.0 username-password flow (USERNAME_PASSWORD), and the subject (sub) of the JWT assertion in the JWT flow.

String

Endpoint Options

The Salesforce endpoint is configured using URI syntax:

salesforce:operationName:topicName

With the following path and query parameters:

Path Parameters

Name Description Default Type

operationName (common)

Required The Salesforce operation to perform: for the producer a REST, Bulk API v1, Bulk API 2.0, Analytics, Composite, Approval or raw operation, such as getSObject, query, apexCall or bulk2CreateJob, or pubSubPublish; for the consumer subscribe (Streaming API) or pubSubSubscribe (Pub/Sub API).

Enum values:

  • getVersions

  • getResources

  • getGlobalObjects

  • getBasicInfo

  • getDescription

  • getSObject

  • createSObject

  • updateSObject

  • deleteSObject

  • getSObjectWithId

  • upsertSObject

  • deleteSObjectWithId

  • getBlobField

  • query

  • queryMore

  • queryAll

  • search

  • apexCall

  • recent

  • getEventSchema

  • 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

  • compositeRetrieveSObjectCollections

  • compositeCreateSObjectCollections

  • compositeUpdateSObjectCollections

  • compositeUpsertSObjectCollections

  • compositeDeleteSObjectCollections

  • bulk2GetAllJobs

  • bulk2CreateJob

  • bulk2GetJob

  • bulk2CreateBatch

  • bulk2CloseJob

  • bulk2AbortJob

  • bulk2DeleteJob

  • bulk2GetSuccessfulResults

  • bulk2GetFailedResults

  • bulk2GetUnprocessedRecords

  • bulk2CreateQueryJob

  • bulk2GetQueryJob

  • bulk2GetAllQueryJobs

  • bulk2GetQueryJobResults

  • bulk2AbortQueryJob

  • bulk2DeleteQueryJob

  • raw

  • subscribe

  • pubSubSubscribe

  • pubSubPublish

OperationName

topicName (common)

Topic to subscribe or publish to, required by subscribe, pubSubSubscribe and pubSubPublish. For subscribe, a PushTopic name such as MyTopic (channel /topic/MyTopic), or a channel such as /event/Order_Evente for a platform event or /data/AccountChangeEvent for a change event; for the Pub/Sub API operations, a topic such as /event/Order_Evente.

String

Query Parameters

Name Description Default Type

apexMethod (common)

HTTP verb used for the Apex REST invocation, such as GET, POST, PUT, PATCH or DELETE. Applies to the apexCall operation and defaults to GET. Can be overridden per message with the CamelSalesforceApexMethod header.

GET

String

apexQueryParams (common)

Query parameters to add to the URL of the apexCall operation. The other unknown parameters of an apexCall endpoint URI are added too, a header named CamelSalesforceApexQueryParam. followed by the parameter name adds or overrides one, and a Map body adds its entries.

Map

apiVersion (common)

Salesforce API version, such as 56.0, used in the URLs of the REST, Bulk, Composite and Analytics API calls. The subscribe consumer needs 24.0 or newer and connects to the Streaming API with the version set on the component; getEventSchema needs 40.0 or newer.

56.0

String

backoffIncrement (common)

Amount, in milliseconds, by which the delay between reconnection attempts grows. For the subscribe consumer (Streaming API), the delay before each handshake or subscribe retry starts at 0; this consumer uses the value set on the component. For the pubSubSubscribe consumer, the delay before subscribing again after an error starts at this value. Login retries use it too.

1000

long

batchId (common)

Identifies a batch within a Bulk API v1 job. Required by getBatch, getRequest, getResults, getQueryResultIds and getQueryResult unless a BatchInfo message body supplies it. Not used by Bulk API 2.0.

String

contentType (common)

Content type of the batch data of the Bulk API v1 createBatch operation, and of createBatchQuery when the body is not a JobInfo: XML, CSV, ZIP_XML or ZIP_CSV (no Content-Type is mapped for JSON and ZIP_JSON). Can be set per message with the CamelSalesforceContentType header.

Enum values:

  • XML

  • CSV

  • JSON

  • ZIP_XML

  • ZIP_CSV

  • ZIP_JSON

ContentType

defaultReplayId (common)

Replay id the subscribe consumer starts from when neither replayId nor initialReplayIdMap gives one for the channel: -1 receives only new events, -2 all the events Salesforce still retains.

-1

Long

fallBackReplayId (common)

Replay id the subscribe consumer subscribes again with when Salesforce rejects the replay id as invalid, for example because it is too old: -1 for new events only, -2 for all retained events.

-1

Long

format (common)

Payload format of the raw operation, JSON or XML: it sets the Accept and Content-Type headers of the request, unless rawHttpHeaders gives them. The other operations ignore it.

Enum values:

  • JSON

  • XML

PayloadFormat

httpClient (common)

Custom SalesforceHttpClient (a Jetty HTTP client) to use. Set on the component, it replaces the client the component creates; set on an endpoint, only the Bulk, Bulk 2.0, Analytics, Composite and SObject Collections operations use it.

SalesforceHttpClient

includeDetails (common)

Whether executeSyncReport and executeAsyncReport return the detail rows of the report as well as the summary (the includeDetails parameter). When not set, the parameter is not sent and the Salesforce default (false) applies. Can be set per message with the CamelSalesforceIncludeDetails header.

Boolean

initialReplayIdMap (common)

Replay ids that the subscribe consumer starts from, per channel, keyed by topic name or channel name (such as /topic/MyTopic or /event/Order_Event__e). They take precedence over defaultReplayId, and replayId takes precedence over them.

Map

instanceId (common)

Id of the report instance whose results getReportResults returns, as returned by executeAsyncReport. Can be set per message with the CamelSalesforceInstanceId header.

String

jobId (common)

Identifies the Bulk API job to act on, for Bulk API v1 operations such as getJob, closeJob, abortJob, createBatch and getResults, and for the bulk2 operations that target an existing job. Operations that accept a JobInfo or BatchInfo message body can take the id from there instead.

String

limit (common)

Maximum number of items that the recent operation returns (the limit parameter). Can be set per message with the CamelSalesforceLimit header or the body.

Integer

locator (common)

Locator of the next set of results of a Bulk API 2.0 query job for bulk2GetQueryJobResults, from the Sforce-Locator header of the previous response (which the producer copies into the message headers). Can be set per message with the CamelSalesforceLocator header.

String

maxBackoff (common)

Upper limit, in milliseconds, of the delay between reconnection attempts. The subscribe consumer (Streaming API) stops retrying the handshake or subscription once the delay exceeds it; this consumer uses the value set on the component. The pubSubSubscribe consumer keeps retrying with at most this delay. Login retries wait at most this long.

30000

long

maxRecords (common)

Maximum number of records per set of results that bulk2GetQueryJobResults returns (the maxRecords parameter); when not set, Salesforce decides. A smaller value avoids timeouts with very large results; get the next set with locator. Can be set per message with the CamelSalesforceMaxRecords header.

Integer

notFoundBehaviour (common)

What the REST operations, such as getSObject, getSObjectWithId, query and apexCall, do when Salesforce answers 404 Not Found: EXCEPTION fails the exchange with a NoSuchSObjectException, NULL sets the message body to null.

Enum values:

  • EXCEPTION

  • NULL

EXCEPTION

NotFoundBehaviour

notifyForFields (common)

NotifyForFields of the PushTopic that the subscribe consumer creates or updates: which fields Salesforce evaluates to decide whether a change matches the query, ALL, REFERENCED, SELECT or WHERE. When not set, the Salesforce default applies.

Enum values:

  • ALL

  • REFERENCED

  • SELECT

  • WHERE

NotifyForFieldsEnum

notifyForOperationCreate (common)

Whether creating a record generates a notification: the NotifyForOperationCreate field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

notifyForOperationDelete (common)

Whether deleting a record generates a notification: the NotifyForOperationDelete field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

notifyForOperations (common)

NotifyForOperations of the PushTopic that the subscribe consumer creates or updates: ALL, CREATE, EXTENDED or UPDATE. Only for API versions before 29.0; with 29.0 or newer it fails the start of the consumer, use the notifyForOperation options instead.

Enum values:

  • ALL

  • CREATE

  • EXTENDED

  • UPDATE

NotifyForOperationsEnum

notifyForOperationUndelete (common)

Whether undeleting a record generates a notification: the NotifyForOperationUndelete field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

notifyForOperationUpdate (common)

Whether updating a record generates a notification: the NotifyForOperationUpdate field of the PushTopic that the subscribe consumer creates or updates. For API version 29.0 or newer; with an older version it fails the start of the consumer. When not set, the field is not sent and the Salesforce default applies.

Boolean

objectMapper (common)

Custom Jackson ObjectMapper to marshal and unmarshal the JSON of the REST, Composite, SObject Collections and Bulk 2.0 operations and of the subscribe consumer, for example to register more modules.

ObjectMapper

pkChunking (common)

Whether the Bulk API v1 operations send the Sforce-Enable-PKChunking header, so that Salesforce splits a bulk query job on the record ids into several batches. Salesforce acts on it when createJob creates the job. Bulk API 2.0 does PK chunking by itself. Can be set per message with the CamelSalesforcePkChunking header.

false

Boolean

pkChunkingChunkSize (common)

Number of records per chunk with pkChunking, sent as chunkSize in the Sforce-Enable-PKChunking header. Salesforce defaults to 100,000 and allows up to 250,000.

Integer

pkChunkingParent (common)

Parent object for pkChunking of a query on a sharing object, sent as parent in the Sforce-Enable-PKChunking header: the chunks are based on the records of the parent object, for example Account for AccountShare.

String

pkChunkingStartRow (common)

15-character or 18-character record id to use as the lower boundary of the first chunk with pkChunking, sent as startRow in the Sforce-Enable-PKChunking header, for example to restart a job that failed between batches.

String

queryLocator (common)

Query locator of the next page of jobs for bulk2GetAllJobs and bulk2GetAllQueryJobs: the queryLocator value in the nextRecordsUrl of the previous result, when its done property is false. Can be set per message with the CamelSalesforceQueryLocator header.

String

rawPayload (common)

Whether to work with the JSON as is instead of DTOs. The REST, apexCall and composite operations give the response as an InputStream (composite then also sends the body as is), and the subscribe consumer gives the message as JSON text: the sObject of a PushTopic event, or the whole message of a platform or change event.

false

boolean

reportId (common)

Id of the report for the Analytics API operations getReportDescription, executeSyncReport, executeAsyncReport, getReportInstances and getReportResults. When neither this option nor the CamelSalesforceReportId header is set, the body is used, or the id of a ReportMetadata body for the execute operations.

String

reportMetadata (common)

Report metadata, such as filters, to run executeSyncReport or executeAsyncReport with, instead of the saved settings of the report. A ReportMetadata body takes precedence. Can be set per message with the CamelSalesforceReportMetadata header.

ReportMetadata

resultId (common)

Identifies one result set of a completed Bulk API v1 query batch, as returned by the getQueryResultIds operation. Used only by getQueryResult, together with jobId and batchId.

String

sObjectBlobFieldName (common)

Name of the blob field that getBlobField downloads, such as Body of an Attachment or VersionData of a ContentVersion. Can be set per message with the CamelSalesforceSObjectBlobFieldName header.

String

sObjectClass (common)

Fully qualified name of the DTO class to unmarshal the response to, usually generated by the camel-salesforce-maven-plugin; for query, queryAll and queryMore a QueryRecords class. Used by the SObject, query, apexCall and compositeRetrieveSObjectCollections operations, and by the subscribe consumer for PushTopic records. When neither this nor sObjectName is set, the producer looks up the class in packages by the type in the response. Can be set per message with the CamelSalesforceSObjectClass header.

String

sObjectFields (common)

Comma-separated list of the fields to return: for getSObject (all fields when not set), and for compositeRetrieveSObjectCollections, which requires it. Can be set per message with the CamelSalesforceSObjectFields header.

String

sObjectId (common)

Id of the record for getSObject, updateSObject, deleteSObject and getBlobField. When the body is a DTO, its Id field is used instead; when neither this option nor the CamelSalesforceSObjectId header is set, the body is the id.

String

sObjectIdName (common)

Name of the external ID field that identifies the record, for getSObjectWithId, upsertSObject, deleteSObjectWithId and compositeUpsertSObjectCollections. Can be set per message with the CamelSalesforceSObjectIdName header.

String

sObjectIdValue (common)

Value of the external ID field (sObjectIdName) that identifies the record, for getSObjectWithId, upsertSObject and deleteSObjectWithId. When the body is a DTO, the value of that field in the DTO is used; otherwise this option, the CamelSalesforceSObjectIdValue header or, except for upsertSObject, the body.

String

sObjectName (common)

Name of the SObject, such as Account or Merchandise__c, for the SObject operations (such as getSObject, createSObject, upsertSObject, getBasicInfo and getDescription) and the SObject Collections operations. It also selects the DTO class of that name in packages to unmarshal the response to, and for the subscribe consumer the class of the PushTopic records. When not set, the simple class name of a DTO body is used. Can be set per message with the CamelSalesforceSObjectName header.

String

sObjectQuery (common)

SOQL query for query, queryAll and the Bulk API v1 createBatchQuery; for queryMore, the nextRecordsUrl of the previous result. When neither this option nor the CamelSalesforceSObjectQuery header is set, the producer uses the body. For the subscribe consumer, the query of the PushTopic to create or update.

String

sObjectSearch (common)

SOSL search for the search operation. When neither this option nor the CamelSalesforceSObjectSearch header is set, the body is used.

String

streamQueryResult (common)

Whether query and queryAll give an Iterator over all the matching records instead of one page of results: the following pages are fetched while iterating. Also sets the CamelSalesforceQueryResultTotalSize header. Can be set per message with the CamelSalesforceStreamQueryResult header.

false

Boolean

updateTopic (common)

Whether the subscribe consumer updates an existing PushTopic whose query or notifyFor* settings differ from those of the endpoint. When false, such a difference fails the start of the consumer. Only used when sObjectQuery is set.

false

boolean

fallbackToLatestReplayId (consumer)

What the pubSubSubscribe consumer does when Salesforce rejects the replay id as corrupted. When true, it subscribes again with the LATEST preset, so the events in between are skipped. When false, it passes an InvalidReplayIdException to the exception handler of the consumer (use bridgeErrorHandler to handle it in the route) and does not subscribe again.

false

boolean

pubSubBatchSize (consumer)

Number of events the pubSubSubscribe consumer asks for in each FetchRequest (num_requested); after each response it asks for more, to keep this many requested. Salesforce accepts at most 100.

100

int

pubSubDeserializeType (consumer)

How the pubSubSubscribe consumer turns the Avro payload of an event into the message body. AVRO gives a SpecificRecord when a generated class named after the schema is in the com.sforce.eventbus package, otherwise a GenericRecord; SPECIFIC_RECORD always that SpecificRecord class; GENERIC_RECORD a GenericRecord; POJO an object of pubSubPojoClass, read with Avro reflection; JSON the event as JSON text.

Enum values:

  • AVRO

  • SPECIFIC_RECORD

  • GENERIC_RECORD

  • POJO

  • JSON

AVRO

PubSubDeserializeType

pubSubPojoClass (consumer)

Fully qualified name of the class that the pubSubSubscribe consumer reads events into, with Avro reflection, when pubSubDeserializeType is POJO.

String

pubSubReplayId (consumer)

Replay id that the pubSubSubscribe consumer starts after when replayPreset is CUSTOM, which requires it, in the base64 form of the CamelSalesforcePubSubReplayId header. Not used with the other presets.

String

replayId (consumer)

Replay id that the subscribe consumer (Streaming API) starts after, for example the CamelSalesforceReplayId header of the last processed event; -1 for new events only, -2 for all the events Salesforce still retains. Takes precedence over initialReplayIdMap and defaultReplayId.

Long

replayPreset (consumer)

Where the pubSubSubscribe consumer starts in the event stream: LATEST receives only new events, EARLIEST all the events Salesforce still retains, CUSTOM the events after pubSubReplayId, which it requires. After an error, the consumer subscribes again after the last event it received.

Enum values:

  • LATEST

  • EARLIEST

  • CUSTOM

LATEST

ReplayPreset

bridgeErrorHandler (consumer (advanced))

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. 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

consumerWorkerPoolEnabled (consumer (advanced))

Whether the subscribe and pubSubSubscribe consumers process the received events on a thread pool, of consumerWorkerPoolSize to consumerWorkerPoolMaxSize threads, instead of the thread that received them, so that events are processed in parallel.

false

boolean

consumerWorkerPoolExecutorService (consumer (advanced))

Custom thread pool on which the subscribe and pubSubSubscribe consumers process the received events, for example to process them in parallel. When set, it is used even when consumerWorkerPoolEnabled is false.

ExecutorService

consumerWorkerPoolMaxSize (consumer (advanced))

Maximum number of threads of the thread pool that consumerWorkerPoolEnabled creates.

20

int

consumerWorkerPoolSize (consumer (advanced))

Core number of threads of the thread pool that consumerWorkerPoolEnabled creates.

10

int

exceptionHandler (consumer (advanced))

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 (advanced))

Sets the exchange pattern when the consumer creates an exchange.

Enum values:

  • InOnly

  • InOut

ExchangePattern

allOrNone (producer)

Whether the SObject Collections operations (compositeCreateSObjectCollections, compositeUpdateSObjectCollections, compositeUpsertSObjectCollections and compositeDeleteSObjectCollections) roll back the whole request when one record fails. The composite, composite-batch and composite-tree operations do not use it. Can be set per message with the CamelSalesforceAllOrNone header.

false

boolean

apexUrl (producer)

Path of the Apex REST resource to invoke, appended to /services/apexrest/ on the instance URL, for example MyApexClass/. The apexCall operation needs this value, which can be given as this option, in the endpoint path as apexCall/MyApexClass/, or in the CamelSalesforceApexUrl header. Placeholders written in curly braces are resolved from message headers of the same name.

String

approval (producer)

The approval request for the Salesforce Approval API. Options approval.actionType, approval.comments, approval.contextActorId, approval.contextId, approval.nextApproverIds, approval.processDefinitionNameOrId, approval.skipEntryCriteria are bound as nested properties.

ApprovalRequest

compositeMethod (producer)

HTTP method of the composite operation when rawPayload is true, for example GET; defaults to POST. Can be set per message with the CamelSalesforceCompositeMethod header.

String

eventName (producer)

Name of the platform event or change event, such as Order_Event__e or AccountChangeEvent, whose schema getEventSchema returns. Can be set per message with the CamelSalesforceEventName header.

String

eventSchemaFormat (producer)

Format of the schema that getEventSchema returns: EXPANDED (Apache Avro, but not strict about the record complex type) or COMPACT (follows the Apache Avro specification of the record complex type). EXPANDED is sent when not set; Salesforce accepts this parameter from API version 43.0. Can be set per message with the CamelSalesforceEventSchemaFormat header.

Enum values:

  • EXPANDED

  • COMPACT

EventSchemaFormatEnum

eventSchemaId (producer)

Id of the event schema that getEventSchema returns, used when eventName is not set. Can be set per message with the CamelSalesforceEventSchemaId header.

String

rawHttpHeaders (producer)

Comma-separated names of the message headers that the raw operation sends as HTTP headers, for example to set Accept or Content-Type.

String

rawMethod (producer)

HTTP method of the raw operation, such as GET, POST, PATCH or DELETE. Can be set per message with the CamelSalesforceRawMethod header.

String

rawPath (producer)

Path of the request of the raw operation, appended to the instance URL, for example /services/data/v56.0/sobjects/Account/. Can be set per message with the CamelSalesforceRawPath header.

String

rawQueryParameters (producer)

Comma-separated names of the message headers that the raw operation sends as query parameters of the same name. The values are URL-encoded, so do not encode them. A missing header fails the request.

String

lazyStartProducer (producer (advanced))

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

Message Headers

The Salesforce component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelSalesforceReplayId (consumer)

Constant: HEADER_SALESFORCE_REPLAY_ID

Replay id of the received Streaming API event. Give it as replayId, or in initialReplayIdMap, to receive the events after it.

Object

CamelSalesforceEventUuid (consumer)

Constant: HEADER_SALESFORCE_EVENT_UUID

Universally unique id (EventUuid) of the received Streaming API event, when the event has one.

Object

CamelSalesforceChangeEventSchema (consumer)

Constant: HEADER_SALESFORCE_CHANGE_EVENT_SCHEMA

Id of the schema of the received change event, from the schema field of the Streaming API message.

Object

CamelSalesforceEventType (consumer)

Constant: HEADER_SALESFORCE_EVENT_TYPE

For change and platform events, the last segment of the configured topic name, such as AccountChangeEvent. For PushTopic messages, the Salesforce event type of the notification, such as created.

String

CamelSalesforceCommitTimestamp (consumer)

Constant: HEADER_SALESFORCE_COMMIT_TIMESTAMP

Time of the Salesforce transaction that produced the change event, from the ChangeEventHeader.

Object

CamelSalesforceCommitUser (consumer)

Constant: HEADER_SALESFORCE_COMMIT_USER

Id of the Salesforce user whose transaction produced the change event, from the ChangeEventHeader.

Object

CamelSalesforceCommitNumber (consumer)

Constant: HEADER_SALESFORCE_COMMIT_NUMBER

System change number of the Salesforce transaction that produced the change event, from the ChangeEventHeader.

Object

CamelSalesforceRecordIds (consumer)

Constant: HEADER_SALESFORCE_RECORD_IDS

Ids of the records affected by the change event, from the ChangeEventHeader. Holds more than one id when a single transaction changed several records.

Object

CamelSalesforceChangeType (consumer)

Constant: HEADER_SALESFORCE_CHANGE_TYPE

Kind of change carried by the change event, from the ChangeEventHeader, for example CREATE or UPDATE.

Object

CamelSalesforceChangeOrigin (consumer)

Constant: HEADER_SALESFORCE_CHANGE_ORIGIN

Identifies the Salesforce API and client that made the change, from the ChangeEventHeader.

Object

CamelSalesforceTransactionKey (consumer)

Constant: HEADER_SALESFORCE_TRANSACTION_KEY

Key shared by every change event produced by the same Salesforce transaction, from the ChangeEventHeader. Use it to group events that belong to one transaction.

Object

CamelSalesforceSequenceNumber (consumer)

Constant: HEADER_SALESFORCE_SEQUENCE_NUMBER

Position of this change event within its Salesforce transaction, from the ChangeEventHeader.

Object

CamelSalesforceIsTransactionEnd (consumer)

Constant: HEADER_SALESFORCE_IS_TRANSACTION_END

True when this change event is the last one of its Salesforce transaction, from the ChangeEventHeader. Use it together with CamelSalesforceTransactionKey to detect the end of a transaction.

Object

CamelSalesforceEntityName (consumer)

Constant: HEADER_SALESFORCE_ENTITY_NAME

Name of the Salesforce object the change event applies to, such as Account, from the ChangeEventHeader.

Object

CamelSalesforcePlatformEventSchema (consumer)

Constant: HEADER_SALESFORCE_PLATFORM_EVENT_SCHEMA

Id of the schema of the received platform event, from the schema field of the Streaming API message.

Object

CamelSalesforceCreatedDate (consumer)

Constant: HEADER_SALESFORCE_CREATED_DATE

Creation time of the event. Platform events supply a ZonedDateTime taken from the event payload, while PushTopic notifications supply the raw createdDate value as a String.

ZonedDateTime

CamelSalesforceTopicName (consumer)

Constant: HEADER_SALESFORCE_TOPIC_NAME

Name of the PushTopic the message was received from. Set for PushTopic messages only.

String

CamelSalesforceChannel (consumer)

Constant: HEADER_SALESFORCE_CHANNEL

Streaming API channel the message was received on, such as /topic/MyTopic or /data/AccountChangeEvent.

String

CamelSalesforceClientId (consumer)

Constant: HEADER_SALESFORCE_CLIENT_ID

Client id of the Streaming API subscription that received the message. Set only when the server supplies one.

String

CamelSalesforcePubSubReplayId (consumer)

Constant: HEADER_SALESFORCE_PUBSUB_REPLAY_ID

Replay id of the received Pub/Sub API event, base64-encoded. Give it as pubSubReplayId, with replayPreset CUSTOM, to receive the events after it.

String

CamelSalesforcePubSubEventId (consumer)

Constant: HEADER_SALESFORCE_PUBSUB_EVENT_ID

Id of the received Pub/Sub API event.

String

CamelSalesforcePubSubRpcId (consumer)

Constant: HEADER_SALESFORCE_PUBSUB_RPC_ID

Id of the Pub/Sub API call that delivered the event, which Salesforce uses to trace errors.

String

CamelSalesforceQueryResultTotalSize (producer)

Constant: HEADER_SALESFORCE_QUERY_RESULT_TOTAL_SIZE

Total number of records that match the SOQL query, set by query and queryAll when streamQueryResult is true.

int

CamelSalesforceSObjectName (producer)

Constant: SOBJECT_NAME

Name of the SObject, such as Account, for the SObject and SObject Collections operations, instead of the sObjectName option. It also selects the DTO class of that name to unmarshal the response to. getBasicInfo and getDescription take the body when neither is set.

String

CamelSalesforceSObjectId (producer)

Constant: SOBJECT_ID

Id of the record for getSObject, updateSObject, deleteSObject and getBlobField, instead of the sObjectId option. Not used when the body is a DTO, whose Id field is used; when neither is set, the body is the id.

String

CamelSalesforceSObjectIds (producer)

Constant: SOBJECT_IDS

Ids of the records for compositeRetrieveSObjectCollections, which requires it, and compositeDeleteSObjectCollections, which takes the body when it is not set. A List of String or a comma-separated String.

List or String

CamelSalesforceSObjectFields (producer)

Constant: SOBJECT_FIELDS

Fields to return, for getSObject and compositeRetrieveSObjectCollections, instead of the sObjectFields option. A comma-separated String, or a List of String for compositeRetrieveSObjectCollections.

String

CamelSalesforceSObjectIdName (producer)

Constant: SOBJECT_EXT_ID_NAME

Name of the external ID field that identifies the record, for getSObjectWithId, upsertSObject, deleteSObjectWithId and compositeUpsertSObjectCollections, instead of the sObjectIdName option.

String

CamelSalesforceSObjectIdValue (producer)

Constant: SOBJECT_EXT_ID_VALUE

Value of the external ID field that identifies the record, for getSObjectWithId, upsertSObject and deleteSObjectWithId, instead of the sObjectIdValue option. Not used when the body is a DTO, whose field value is used.

String

CamelSalesforceSObjectBlobFieldName (producer)

Constant: SOBJECT_BLOB_FIELD_NAME

Name of the blob field that getBlobField downloads, such as Body of an Attachment, instead of the sObjectBlobFieldName option.

String

CamelSalesforceSObjectClass (producer)

Constant: SOBJECT_CLASS

Fully qualified name of the DTO class to unmarshal the response to, instead of the sObjectClass option.

String

CamelSalesforceSObjectQuery (producer)

Constant: SOBJECT_QUERY

SOQL query for query, queryAll and the Bulk API v1 createBatchQuery, or the nextRecordsUrl of the previous result for queryMore, instead of the sObjectQuery option. When neither is set, the body is used.

String

CamelSalesforceStreamQueryResult (producer)

Constant: STREAM_QUERY_RESULT

Whether query and queryAll give an Iterator over all the matching records instead of one page of results, instead of the streamQueryResult option.

Boolean

CamelSalesforceSObjectSearch (producer)

Constant: SOBJECT_SEARCH

SOSL search for the search operation, instead of the sObjectSearch option. When neither is set, the body is used.

String

CamelSalesforceApexMethod (producer)

Constant: APEX_METHOD

HTTP method of the apexCall operation, such as GET or POST, instead of the apexMethod option. GET when neither is set.

String

CamelSalesforceApexUrl (producer)

Constant: APEX_URL

Path of the Apex REST resource for apexCall, appended to /services/apexrest/, instead of the apexUrl option. Placeholders in curly braces are replaced by the URL-encoded values of the message headers of the same name.

String

CamelSalesforceApexQueryParam. (producer)

Constant: APEX_QUERY_PARAM_PREFIX

The prefix of the headers that add or override a query parameter of the apexCall operation: the header CamelSalesforceApexQueryParam.name holds the parameter name.

Object

CamelSalesforceCompositeMethod (producer)

Constant: COMPOSITE_METHOD

HTTP method of the composite operation when rawPayload is true, such as GET, instead of the compositeMethod option. POST when neither is set.

String

CamelSalesforceLimit (producer)

Constant: LIMIT

Maximum number of items that the recent operation returns, instead of the limit option. When neither is set, the body is used if it converts to an Integer.

Integer

CamelSalesforceAllOrNone (producer)

Constant: ALL_OR_NONE

Whether the SObject Collections operations roll back the whole request when one record fails, instead of the allOrNone option.

Boolean

CamelSalesforceEventName (producer)

Constant: EVENT_NAME

Name of the platform event or change event whose schema getEventSchema returns, instead of the eventName option.

String

CamelSalesforceEventSchemaId (producer)

Constant: EVENT_SCHEMA_ID

Id of the event schema that getEventSchema returns when no event name is set, instead of the eventSchemaId option.

String

CamelSalesforceEventSchemaFormat (producer)

Constant: EVENT_SCHEMA_FORMAT

Format of the schema that getEventSchema returns, EXPANDED or COMPACT, instead of the eventSchemaFormat option.

Enum values:

  • EXPANDED

  • COMPACT

EventSchemaFormatEnum

approval (producer)

Constant: APPROVAL

The approval request of the approval operation, instead of the approval option. The headers with the approval. prefix set its properties, such as approval.ContextId for contextId, and the values of an ApprovalRequest body take precedence over both.

ApprovalRequest

CamelSalesforceContentType (producer)

Constant: CONTENT_TYPE

Content type of the batch data of the Bulk API v1 createBatch and createBatchQuery operations, such as CSV or XML, instead of the contentType option.

String

CamelSalesforceJobId (producer)

Constant: JOB_ID

Id of the Bulk API job to act on, for the Bulk API v1 and bulk2 operations that target an existing job, instead of the jobId option. Not used when the body is a JobInfo, whose id is used.

String

CamelSalesforceBatchId (producer)

Constant: BATCH_ID

Id of a batch of a Bulk API v1 job, for getBatch, getRequest, getResults, getQueryResultIds and getQueryResult, instead of the batchId option. Not used when the body is a BatchInfo, whose id is used.

String

CamelSalesforceResultId (producer)

Constant: RESULT_ID

Id of a result set of a Bulk API v1 query batch, for getQueryResult, instead of the resultId option.

String

CamelSalesforceQueryLocator (producer)

Constant: QUERY_LOCATOR

Query locator of the next page of jobs for bulk2GetAllJobs and bulk2GetAllQueryJobs, instead of the queryLocator option.

String

CamelSalesforceLocator (producer)

Constant: LOCATOR

Locator of the next set of results of bulk2GetQueryJobResults, from the Sforce-Locator header of the previous response, instead of the locator option.

String

CamelSalesforceMaxRecords (producer)

Constant: MAX_RECORDS

Maximum number of records per set of results that bulk2GetQueryJobResults returns, instead of the maxRecords option.

Integer

CamelSalesforcePkChunking (producer)

Constant: PK_CHUNKING

Whether the Bulk API v1 operations send the Sforce-Enable-PKChunking header, so that Salesforce splits a bulk query job on the record ids into several batches.

Boolean

CamelSalesforcePkChunkingChunkSize (producer)

Constant: PK_CHUNKING_CHUNK_SIZE

Number of records per chunk when CamelSalesforcePkChunking is true, sent as chunkSize in the Sforce-Enable-PKChunking header.

Integer

CamelSalesforcePkChunkingParent (producer)

Constant: PK_CHUNKING_PARENT

Parent object for PK chunking of a query on a sharing object when CamelSalesforcePkChunking is true, sent as parent in the Sforce-Enable-PKChunking header.

String

CamelSalesforcePkChunkingStartRow (producer)

Constant: PK_CHUNKING_START_ROW

Record id to use as the lower boundary of the first chunk when CamelSalesforcePkChunking is true, sent as startRow in the Sforce-Enable-PKChunking header.

String

CamelSalesforceReportId (producer)

Constant: REPORT_ID

Id of the report for the Analytics API operations, instead of the reportId option. When neither is set, the body is used, or the id of a ReportMetadata body for the execute operations.

String

CamelSalesforceIncludeDetails (producer)

Constant: INCLUDE_DETAILS

Whether executeSyncReport and executeAsyncReport return the detail rows of the report, instead of the includeDetails option. The converter of report results to a List of rows also reads it: false leaves out the detail rows (true by default).

Boolean

CamelSalesforceReportMetadata (producer)

Constant: REPORT_METADATA

Report metadata, such as filters, to run executeSyncReport or executeAsyncReport with, instead of the reportMetadata option. A ReportMetadata body takes precedence.

ReportMetadata

CamelSalesforceInstanceId (producer)

Constant: INSTANCE_ID

Id of the report instance whose results getReportResults returns, instead of the instanceId option.

String

CamelSalesforceIncludeHeaders (producer)

Constant: INCLUDE_HEADERS

Whether the converter of report results to a List of rows adds the row of column labels. True when not set.

Boolean

CamelSalesforceIncludeSummary (producer)

Constant: INCLUDE_SUMMARY

Whether the converter of report results to a List of rows adds the summary values. True when not set.

Boolean

CamelSalesforceRawPath (producer)

Constant: RAW_PATH

Path of the request of the raw operation, appended to the instance URL, instead of the rawPath option.

String

CamelSalesforceRawMethod (producer)

Constant: RAW_METHOD

HTTP method of the raw operation, such as GET or POST, instead of the rawMethod option.

String

CamelSalesforceRawQueryParameters (producer)

Constant: RAW_QUERY_PARAMETERS

Comma-separated names of the message headers that the raw operation sends as query parameters, instead of the rawQueryParameters option.

String

CamelSalesforceRawHttpHeaders (producer)

Constant: RAW_HTTP_HEADERS

Comma-separated names of the message headers that the raw operation sends as HTTP headers, instead of the rawHttpHeaders option.

String

Sforce (producer)

Constant: SFORCE_HEADER_PREFIX

The prefix of the Salesforce HTTP headers, such as Sforce-Limit-Info or Sforce-Locator. The producer sends the message headers whose name starts with Sforce, in any case, as HTTP headers of the request, and copies the response headers that start with Sforce to the message headers.

String

x-sfdc (producer)

Constant: X_SFDC_HEADER_PREFIX

The prefix of other Salesforce HTTP request headers. The producer sends the message headers whose name starts with x-sfdc, in any case, as HTTP headers of the request.

String

CamelHttpResponseCode (producer)

Constant: HTTP_RESPONSE_CODE

The HTTP status code of the response of the Salesforce API, as a String. Not set when the request got no response.

String

CamelHttpResponseText (producer)

Constant: HTTP_RESPONSE_TEXT

The HTTP reason phrase of the response of the Salesforce API. Not set when the request got no response.

String

Message Body

The message body at each side of the Salesforce component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.

Side Body Description

Consumer

map or pojo

The subscribe operation gives a push topic record as a Map, or an object of sObjectClass (or the DTO of sObjectName), a platform event (/event/) as a PlatformEvent, and a change event (/data/) as a Map of the changed fields, with the replay id and the change event header in headers; rawPayload=true gives the JSON text instead. pubSubSubscribe gives an Avro GenericRecord or SpecificRecord, an object of pubSubPojoClass with POJO, or JSON text with JSON.

  • With operationName=pubSubSubscribe: pojo

  • With rawPayload=true: text or pojo

  • With pubSubDeserializeType=JSON: text, map or pojo

Producer input

text, bytes, stream, file, pojo, list, map or null

The REST operations send a generated DTO (an AbstractSObjectBase), a Map or another object as JSON, or JSON text, bytes, a stream or a file as is. Text in the body is the id, SOQL or SOSL when the option or header is not set. apexCall takes a Map as query parameters; bulk operations take a JobInfo, BatchInfo or Job, and createBatch the CSV or XML records as a stream; composite operations an SObjectComposite, SObjectBatch or SObjectTree, the SObject collections a List of DTOs; pubSubPublish a List of events; raw the request as a stream (a body that cannot be converted to a stream, such as a Map, fails).

Producer output

pojo, list, map, stream, unchanged or null

The response as a DTO: a CreateSObjectResult, the SObject DTO of sObjectName or sObjectClass, a QueryRecords class for a query (an Iterator of the records with streamQueryResult=true), JobInfo or Job for bulk, a List for getVersions, the collections and pubSubPublish; a DTO class that is not in packages fails: set sObjectClass or use rawPayload. getBlobField, raw and the bulk results give a stream; an update or delete with no content leaves the body. rawPayload=true gives the JSON of the REST, apexCall and composite responses as a stream; format=JSON or XML only sets the content type of raw.

  • With operationName=createSObject: pojo (org.apache.camel.component.salesforce.api.dto.CreateSObjectResult)

  • With operationName=upsertSObject: pojo or unchanged

  • With operationName=updateSObject: unchanged

  • With operationName=deleteSObject: unchanged

  • With operationName=deleteSObjectWithId: unchanged

  • With operationName=getSObject: pojo

  • With operationName=getSObjectWithId: pojo

  • With operationName=query: pojo or stream

  • With operationName=queryAll: pojo or stream

  • With operationName=queryMore: pojo or stream

  • With operationName=getBlobField: stream

  • With operationName=getVersions: list

  • With operationName=apexCall: pojo, map, stream or unchanged

  • With operationName=raw: stream or null

  • With operationName=compositeCreateSObjectCollections: list

  • With operationName=compositeUpdateSObjectCollections: list

  • With operationName=compositeUpsertSObjectCollections: list

  • With operationName=compositeRetrieveSObjectCollections: list

  • With operationName=compositeDeleteSObjectCollections: list

  • With operationName=pubSubPublish: list

  • With rawPayload=true: stream, pojo, list, unchanged or null

Not known when streamQueryResult or notFoundBehaviour is set.

The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.

Usage

Authenticating to Salesforce

The component supports four OAuth authentication flows:

For each of the flows, different sets of properties need to be set:

Table 1. Properties to set for each authentication flow
Property Where to find it on Salesforce Flow

clientId

Connected App, Consumer Key

All flows

clientSecret

Connected App, Consumer Secret

Username-Password, Refresh Token, Client Credentials

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. In order to be explicit, set the authenticationType property.

Using Username-Password Flow in production is not encouraged.

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

General Usage

URI format

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

salesforce:subscribe:topic?options

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

salesforce:operationName?options

As a general example on using the operations in this salesforce component, 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.

Java-only: endpoint URI snippet
...to("salesforce:upsertSObject?sObjectIdName=Name")...

Supplying operation parameters as message headers

The operation parameters described in the per-operation tables below (such as sObjectQuery, sObjectName, sObjectId, sObjectSearch, apexUrl, apexMethod, the apexQueryParam. prefix and the Bulk/Analytics/RAW parameters) can be supplied either as endpoint options or as message headers.

Starting with Camel 4.21, when these parameters are supplied as message headers, the header names follow the standard CamelSalesforce naming convention so that they are governed by the default HeaderFilterStrategy (which only filters Camel/camel-prefixed headers). For example, set the CamelSalesforceSObjectQuery header instead of sObjectQuery, CamelSalesforceApexUrl instead of apexUrl, and use the CamelSalesforceApexQueryParam. prefix instead of apexQueryParam.. The endpoint option spelling is unchanged (for example salesforce:query?sObjectQuery=…​ still works).

Prefer referencing the constants in SalesforceEndpointConfig (for example SalesforceEndpointConfig.SOBJECT_QUERY) when setting these headers, so route code is unaffected by the value change. See the Camel 4.21 upgrade guide for the full list of renamed header names.

Passing in Salesforce headers and fetching Salesforce response headers

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 outbound message headers.

For example, to fetch API limits, you can specify:

Java-only: uses custom Processor implementation to read response headers
// 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);
   }
}

In addition, HTTP response status code and text are available as headers Exchange.HTTP_RESPONSE_CODE and Exchange.HTTP_RESPONSE_TEXT.

Sending null values to salesforce

By default, SObject fields with null values are not sent to salesforce. In order to send null values to salesforce, use the fieldsToNull property, as follows:

Java-only: programmatic SObject field manipulation
accountSObject.getFieldsToNull().add("Site");

Supported Salesforce APIs

Camel supports the following Salesforce APIs:

Apex REST API

Invoke an Apex REST Web Service method

apexCall

You can expose your Apex class and methods so that external applications can access your code and your application through the REST architecture.

The URI format for invoking Apex REST is:

salesforce:apexCall[/yourApexRestUrl][?options]

You can supply the apexUrl either in the endpoint (see above), or as the apexUrl option as listed in the table below. In either case the Apex URL can contain placeholders in the format of {headerName}. E.g., for the Apex URL MyApexClass/{id}, the value of the header named id will be used to replace the placeholder. If rawPayload is false and neither sObjectClass nor sObjectName are set, Camel will attempt to determine the correct AbstractQueryRecordsBase sublcass based on the response.

Parameter Type Description Default Required

Body

Map<String, Object> if GET, otherwise String or InputStream

In the case of a GET, the body (Map instance) is transformed into query parameters. For other HTTP methods, the body is used for the HTTP body.

apexUrl

String

The portion of the endpoint URL after https://instance.salesforce.com/services/apexrest/, e.g., 'MyApexClass/'

Yes, unless supplied in endpoint

apexMethod

String

The HTTP method (e.g. GET, POST) to use.

GET

rawPayload

Boolean

If true, Camel will not serialize the request or response bodies.

false

Header: apexQueryParam.[paramName]

Object

Headers that override apex parameters passed in the endpoint.

sObjectName

String

Name of sObject (e.g. Merchandise__c) used to deserialize the response

sObjectClass

String

Fully qualified class name used to deserialize the response

Output

Type: Instance of class supplied in sObjectClass input header.

Sub-Pages

For more details on specific Salesforce APIs, see:

  • REST API - CRUD operations, queries, composite requests, approvals, and more

  • Bulk API - Bulk 2.0 and original Bulk API for large data operations

  • Streaming and Pub/Sub - Platform events, push topics, change data capture, and Pub/Sub API

  • Reports API - Report execution, instances, and results

Miscellaneous Operations

  • raw - Send requests to salesforce and have full, raw control over endpoint, parameters, body, etc.

Raw

raw

Sends HTTP requests to salesforce with full, raw control of all aspects of the call. Any serialization or deserialization of request and response bodies must be performed in the route. The Content-Type HTTP header will be automatically set based on the format option, but this can be overridden with the rawHttpHeaders option.

Parameter Type Description Default Required

Body

String or InputStream

Body of the HTTP request. A body that cannot be converted to an InputStream, such as a Map, fails with an InvalidPayloadException.

rawPath

String

The portion of the endpoint URL after the domain name, e.g., '/services/data/v51.0/sobjects/Account/'

x

rawMethod

String

The HTTP method

x

rawQueryParameters

String

Comma separated list of message headers to include as query parameters. Do not url-encode values as this will be done automatically.

rawHttpHeaders

String

Comma separated list of message headers to include as HTTP headers

Output

Type: InputStream

Query example

In this example we’ll send a query to the REST API. The query must be passed in a URL parameter called "q", so we’ll create a message header called q and tell the raw operation to include that message header as a URL parameter:

from("direct:queryExample")
  .setHeader("q", "SELECT Id, LastName FROM Contact")
  .to("salesforce:raw?format=JSON&rawMethod=GET&rawQueryParameters=q&rawPath=/services/data/v51.0/query")
  // deserialize JSON results or handle in some other way
SObject example

In this example, we’ll pass a Contact the REST API in a create operation. Since the raw operation does not perform any serialization, we make sure to pass XML in the message body

from("direct:createAContact")
  .setBody(constant("<Contact><LastName>TestLast</LastName></Contact>"))
  .to("salesforce:raw?format=XML&rawMethod=POST&rawPath=/services/data/v51.0/sobjects/Contact")

The response is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Result>
    <id>0034x00000RnV6zAAF</id>
    <success>true</success>
</Result>

Uploading a document to a ContentWorkspace

For efficient document uploads without base64 encoding overhead, use the binary field approach:

Java-only: Processor implementation with Salesforce DTO and binary fields
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");

        // Use binary field for efficient upload - no base64 encoding needed
        InputStream document = message.getBody(InputStream.class);
        cv.setVersionDataBinary(document);  // Automatically triggers multipart request
        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:

Java-only: inline Processor instantiation
from("file:///home/camel/library")
    .to(new ContentProcessor())     // convert file stream into a ContentVersion SObject
                                    // with binary field for efficient upload
    .to("salesforce:createSObject");

Using Base64 Encoding (Legacy)

The traditional base64 encoding approach is still supported for backward compatibility:

Java-only: Processor implementation with base64 encoding
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);
        String enc = Base64.getEncoder().encodeToString(document);
        cv.setVersionData(enc);  // Uses base64 encoding and standard JSON request
        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
        ....
    }
}

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 generate the SOQL SELECT by invoking:

Java-only: QueryHelper API
String allCustomFieldsQuery = QueryHelper.queryToFetchFilteredFieldsOf(new Account(), SObjectField::isCustom);

Camel Salesforce Maven Plugin

The Maven plugin generates Java DTOs to represent salesforce objects.

Please refer to README.md for details on how to use the plugin.