This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Configuring Salesforce Streaming Inbound Endpoint Operations

The Salesforce streaming inbound endpoint allows you to perform various Salesforce streaming data via WSO2 ESB. The Salesforce streaming API receives notifications for changes to Salesforce data that match a Salesforce Object Query Language (SOQL) query you define, in a secure and scalable way. For more information see Salesforce streaming documentation.

Reliable message delivery is only available in Salesforce API version 37.0 and later.

Creating a PushTopic

To use the Salesforce inbound endpoint, you need to first create a PushTopic that contains an SOQL query.

Go to the developer console of your Salesforce account and click on Debug->Open Execute Anonymous Window. Add the following entry in the Enter Apex Code window.  

pushTopic InvoiceStatementUpdates
PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'InvoiceStatementUpdates';
pushTopic.Query = 'SELECT Id, Name, wso2__Status__c, wso2__Description__c FROM wso2__Invoice_Statement__';
pushTopic.ApiVersion = 35.0;
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
insert pushTopic;

Click Execute.

Retrieving the Account information 

WSO2 ESB Salesforce inbound endpoint acts as a message consumer. It creates a connection to the Salesforce account, consumes the Salesforce data and injects the data to the ESB sequence.

Now that you have configured the Salesforce streaming inbound endpoint, use the following ESB inbound endpoint configuration to retrieve account details from your Salesforce account. 

<inboundEndpoint xmlns="http://ws.apache.org/ns/synapse"
             	name="SaleforceInboundEP"
             	sequence="reqSequence"
             	onError="fault"
             	class="org.wso2.carbon.inbound.salesforce.poll.SalesforceStreamData"
             	suspend="false">
   <parameters>
  	<parameter name="sequential">true</parameter>
  	<parameter name="interval">10</parameter>
  	<parameter name="coordination">true</parameter>
    <parameter name="connection.salesforce.userName">MyUsername</parameter>
    <parameter name="connection.salesforce.loginEndpoint">https://login.salesforce.com</parameter>
    <parameter name="connection.salesforce.password">MyPassword</parameter>   
    <parameter name="connection.salesforce.salesforceObject">InvoiceStatementUpdates</parameter> 
    <parameter name="connection.salesforce.connectionTimeout">20000</parameter> 
   	<parameter name="connection.salesforce.readTimeout">110000</parameter> 
   	<parameter name="connection.salesforce.waitTime">10000</parameter> 
 	<parameter name="connection.salesforce.packageName">cometd</parameter> 
   	<parameter name="connection.salesforce.packageVersion">35.0</parameter>
	<parameter name="connection.salesforce.soapApiVersion">22.0</parameter>
 </parameters>
</inboundEndpoint>

Properties

  • connection.salesforce.userName:  The user name for accessing the Salesforce account.
  • connection.salesforce.loginEndpoint: The endpoint for the Salesforce account.

  • connection.salesforce.passwordThe password provided here is a concatenation of the user password and the security token provided by Salesforce. For information on creating a security token in Salesforce, see https://help.salesforce.com/articleView?id=user_security_token.htm&type=5.

  • connection.salesforce.salesforceObject : The name of the push topic that is added to the Salesforce account.
  • connection.salesforce.connectionTimeout: The time to connect to the Salesforce account (default : 20 * 1000 seconds).

  • connection.salesforce.readTimeout: The time to read the data (110 * 1000 seconds).

  • connection.salesforce.waitTime: The time to wait when connecting to the client (default : 10 * 1000s).

  • connection.salesforce.packageName: The event routing bus that implements Bayeux Client.

  • connection.salesforce.packageVersion: The version of the connection.salesforce.packageName.

  • connection.salesforce.soapApiVersion: The version of the salesforce soap API.


  • If the client receives events, it should reconnect immediately to receive the next set of events. If the reconnection doesn't occur within 40 seconds, the server expires the subscription and the connection closes. The client should reconnect with a handshake and subscribe again.
  • If no events are generated while the client is waiting and the server closes the connection, the client should reconnect immediately.