camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache Camel > Salesforce
Date Fri, 30 Aug 2013 09:09:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Salesforce">Salesforce</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (15)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The plugin configuration has the following
properties. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{div:class=confluenceTableSmall}
<br>|| Option || Description || <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> clientId
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> Salesforce
client Id for Remote API access <span class="diff-added-words"style="background-color:
#dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> clientSecret
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> Salesforce
client secret for Remote API access <span class="diff-added-words"style="background-color:
#dfd;">|</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">*
userName - Salesforce account user name <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
userName | Salesforce account user name |  <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> password
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> Salesforce
account password (including secret token) <span class="diff-added-words"style="background-color:
#dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> version
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> Salesforce
Rest API version, defaults to 25.0 <span class="diff-added-words"style="background-color:
#dfd;">|</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">*
outputDirectory - Directory where to place generated DTOs, defaults to ${project.build.directory}/generated-sources/camel-salesforce
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
outputDirectory | Directory where to place generated DTOs, defaults to $\{project.build.directory}/generated-sources/camel-salesforce
| <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> includes
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> List of
SObject types to include <span class="diff-added-words"style="background-color: #dfd;">|</span>
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> excludes
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> List of
SObject types to exclude <span class="diff-added-words"style="background-color: #dfd;">|</span>
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> includePattern
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> Java RegEx
for SObject types to include <span class="diff-added-words"style="background-color: #dfd;">|</span>
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> excludePattern
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> Java RegEx
for SObject types to exclude <span class="diff-added-words"style="background-color: #dfd;">|</span>
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> packageName
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> Java package
name for generated DTOs, defaults to org.apache.camel.salesforce.dto. <span class="diff-added-words"style="background-color:
#dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">
</span> <span class="diff-added-words"style="background-color: #dfd;">{div}</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >For obvious security reasons it is
recommended that the clientId, clientSecret, userName and password fields be not set in the
pom.xml.  <br>The plugin should be configured for the rest of the properties, and can
be executed using the following command: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Salesforce-Salesforcecomponent"></a>Salesforce component</h2>
<p><b>Available as of Camel 2.12</b></p>

<p>This component supports producer and consumer endpoints to communicate with Salesforce
using Java DTOs. <br/>
There is a companion maven plugin <a href="/confluence/pages/createpage.action?spaceKey=CAMEL&amp;title=Camel+Salesforce+Plugin&amp;linkCreation=true&amp;fromPageId=34017774"
class="createlink">Camel Salesforce Plugin</a> that generates these DTOs. </p>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>
for this component:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-salesforce&lt;/artifactId&gt;
    &lt;version&gt;x.x.x&lt;/version&gt;
    &lt;!-- use the same version as your Camel core version --&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<h3><a name="Salesforce-URIformat"></a>URI format</h3>

<p>The URI scheme for a salesforce component is as follows</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
force:topic?options
</pre>
</div></div>

<p>You can append query options to the URI in the following format, <tt>?option=value&amp;option=value&amp;...</tt></p>

<h3><a name="Salesforce-SupportedSalesforceAPIs"></a>Supported Salesforce
APIs</h3>

<p>The component supports the following Salesforce APIs</p>

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

<h4><a name="Salesforce-RestAPI"></a>Rest API</h4>

<ul>
	<li>getVersions - Gets supported Salesforce REST API versions</li>
	<li>getResources - Gets available Salesforce REST Resource endpoints</li>
	<li>getGlobalObjects - Gets metadata for all available SObject types</li>
	<li>getBasicInfo - Gets basic metadata for a specific SObject type</li>
	<li>getDescription - Gets comprehensive metadata for a specific SObject type</li>
	<li>getSObject - Gets an SObject using its Salesforce Id</li>
	<li>createSObject - Creates an SObject</li>
	<li>updateSObject - Updates an SObject using Id</li>
	<li>deleteSObject - Deletes an SObject using Id</li>
	<li>getSObjectWithId - Gets an SObject using an external (user defined) id field</li>
	<li>upsertSObject - Updates or inserts an SObject using an external id</li>
	<li>deleteSObjectWithId - Deletes an SObject using an external id</li>
	<li>query - Runs a Salesforce SOQL query</li>
	<li>queryMore - Retrieves more results (in case of large number of results) using result
link returned from the 'query' API</li>
	<li>search - Runs a Salesforce SOSL query</li>
</ul>


<p>For example, the following producer endpoint uses the upsertSObject API, with the
sObjectIdName parameter specifying 'Name' as the external id field. <br/>
The request message body should be an SObject DTO generated using the maven plugin. <br/>
The response message will either be <tt>null</tt> if an existing record was updated,
or <tt>CreateSObjectResult</tt> with an id of the new record, or a list of errors
while creating the new object.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
	...to("force:upsertSObject?sObjectIdName=Name")...
</pre>
</div></div>


<h4><a name="Salesforce-RestBulkAPI"></a>Rest Bulk API</h4>

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

<ul>
	<li>createJob - Creates a Salesforce Bulk Job</li>
	<li>getJob - Gets a Job using its Salesforce Id</li>
	<li>closeJob - Closes a Job</li>
	<li>abortJob - Aborts a Job</li>
	<li>createBatch - Submits a Batch within a Bulk Job</li>
	<li>getBatch - Gets a Batch using Id</li>
	<li>getAllBatches - Gets all Batches for a Bulk Job Id</li>
	<li>getRequest - Gets Request data (XML/CSV) for a Batch</li>
	<li>getResults - Gets the results of the Batch when its complete</li>
	<li>createBatchQuery - Creates a Batch from an SOQL query</li>
	<li>getQueryResultIds - Gets a list of Result Ids for a Batch Query</li>
	<li>getQueryResult - Gets results for a Result Id</li>
</ul>


<p>For example, the following producer endpoint uses the createBatch API to create a
Job Batch. <br/>
The in message must contain a body that can be converted into an <tt>InputStream</tt>
(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&#95;XML or ZIP&#95;CSV.
The put message body will contain <tt>BatchInfo</tt> on success, or throw a <tt>SalesforceException</tt>
on error.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
	...to("force:createBatchJob")..
</pre>
</div></div>

<h4><a name="Salesforce-RestStreamingAPI"></a>Rest Streaming API</h4>

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

<p>To create and subscribe to a topic</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
	from("force:CamelTestTopic?notifyForFields=ALL&amp;notifyForOperations=ALL&amp;sObjectName=Merchandise__c&amp;updateTopic=true&amp;sObjectQuery=SELECT
Id, Name FROM Merchandise__c")...
</pre>
</div></div>

<p>To subscribe to an existing topic</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
	from("force:CamelTestTopic&amp;sObjectName=Merchandise__c")...
</pre>
</div></div>

<h2><a name="Salesforce-CamelSalesforceMavenPlugin"></a>Camel Salesforce
Maven Plugin</h2>

<p>This Maven plugin generates DTOs for the Camel <a href="/confluence/display/CAMEL/Salesforce"
title="Salesforce">Salesforce</a>.</p>

<h3><a name="Salesforce-Usage"></a>Usage</h3>

<p>The plugin configuration has the following properties.</p>

<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> clientId </td>
<td class='confluenceTd'> Salesforce client Id for Remote API access </td>
</tr>
<tr>
<td class='confluenceTd'> clientSecret </td>
<td class='confluenceTd'> Salesforce client secret for Remote API access </td>
</tr>
<tr>
<td class='confluenceTd'> userName </td>
<td class='confluenceTd'> Salesforce account user name </td>
</tr>
<tr>
<td class='confluenceTd'> password </td>
<td class='confluenceTd'> Salesforce account password (including secret token) </td>
</tr>
<tr>
<td class='confluenceTd'> version </td>
<td class='confluenceTd'> Salesforce Rest API version, defaults to 25.0 </td>
</tr>
<tr>
<td class='confluenceTd'> outputDirectory </td>
<td class='confluenceTd'> Directory where to place generated DTOs, defaults to ${project.build.directory}/generated-sources/camel-salesforce
</td>
</tr>
<tr>
<td class='confluenceTd'> includes </td>
<td class='confluenceTd'> List of SObject types to include </td>
</tr>
<tr>
<td class='confluenceTd'> excludes </td>
<td class='confluenceTd'> List of SObject types to exclude </td>
</tr>
<tr>
<td class='confluenceTd'> includePattern </td>
<td class='confluenceTd'> Java RegEx for SObject types to include </td>
</tr>
<tr>
<td class='confluenceTd'> excludePattern </td>
<td class='confluenceTd'> Java RegEx for SObject types to exclude </td>
</tr>
<tr>
<td class='confluenceTd'> packageName </td>
<td class='confluenceTd'> Java package name for generated DTOs, defaults to org.apache.camel.salesforce.dto.
</td>
</tr>
</tbody></table>
</div>
</div>
<p>For obvious security reasons it is recommended that the clientId, clientSecret, userName
and password fields be not set in the pom.xml. <br/>
The plugin should be configured for the rest of the properties, and can be executed using
the following command:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
	mvn camel-salesforce:generate -DclientId=&lt;clientid&gt; -DclientSecret=&lt;clientsecret&gt;
-DuserName=&lt;username&gt; -Dpassword=&lt;password&gt;
</pre>
</div></div>

<p>The generated DTOs use Jackson and XStream annotations. All Salesforce field types
are supported. Date and time fields are mapped to Joda DateTime, and picklist fields are mapped
to generated Java Enumerations. </p>


<h3><a name="Salesforce-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CAMEL">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Salesforce">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=34017774&revisedVersion=4&originalVersion=3">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Salesforce?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message