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.
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.
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.
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.
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.
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("force:CamelTestTopic?notifyForFields=ALL¬ifyForOperations=ALL&sObjectName=Merchandise__c&updateTopic=true&sObjectQuery=SELECT Id, Name FROM Merchandise__c")...
To subscribe to an existing topic