An inbound endpoint is a specific type of endpoint that serves as an entry point for incoming data, requests or connections. It is typically used in systems where external clients or systems need to communicate with an internal application or service. In general, it is about managing and controlling how external data or requests are received by a system or network.
Handling Salesforce Change Events with WSO2 Inbound Endpoint
In the context of WSO2, an inbound endpoint is a configuration used to manage and handle incoming messages from external systems. It allows us to define how external requests or data streams are received and processed by the integration layer. This is a message entry
point that can inject messages directly from the transport layer to the integration layer without going through the Axis2 engine. Direct injection allows for quicker message processing since the message goes straight to the mediation layer where it can be transformed, routed, or processed according to the defined logic.
The Salesforce Inbound Endpoint in WSO2 is a specialized type of inbound endpoint designed to integrate with Salesforce, a leading cloud-based Customer Relationship Management (CRM) platform. This inbound endpoint allows WSO2 MI to listen for events or changes in Salesforce and trigger integration mediations accordingly.
Configuring WSO2 Inbound Endpoint to Integrate with Salesforce
In this scenario, changes to Salesforce account records are captured and published as change events. The changes include record creation, updates to an existing record, deletion of a record.
For the creation and testing of Salesforce inbound endpoint configuration I’m using the latest WSO2 Micro Integrator 4.3. You can refer to one of our blogs on how to run WSO2 products on Linux/Windows/Mac. Also, access to a Salesforce account with credentials is required for the configuration.
Create a new integration project and then create a new sequence. Add a log and drop mediator to the sequence. The source view of the sequence will look like below:
The integration layer calls the above sequence once the message is received. For the testing purposes, log and drop mediators have been used. The sequence can be modified as required on how the mediation should happen in the integration layer.
Then create a custom inbound endpoint and provide the below configuration:
- sequential:
- Messages should be polled and injected sequentially or not
- interval:
- Defines the time interval (in milliseconds) between polling attempts.
- inbound.behavior:
- Specifies the mode in which the inbound endpoint operates. The value for this parameter is polling. With the parameter, it will periodically poll for the Salesforce for events. Instead of maintaining a constant connection, it checks at regular intervals to see if any new events have occurred.
- coordination:
- Controls whether the inbound endpoint should coordinate its tasks with other instances in a clustered setup.
- connection.salesforce.replay:
- Enabling this will read the event ID stored in the Registry DB or from the text file stored in the local machine. This parameter controls the behavior of event replay, particularly in scenarios where events may have been missed due to downtime or other interruptions.
- connection.salesforce.EventIDStoredFilePath:
- When replay is enabled, specify the directory path of a text file to start replaying from the event ID stored in it. Based on the replay ID, the events will be replayed or consumed by the integration layer.
- connection.salesforce.packageVersion:
- Version of the Salesforce API.
- connection.salesforce.salesforceObject:
- Name of the Push Topic or the Platform Event or the Channel that is added to the Salesforce account. Whenever a change happens to objects (eg: account), such changes are published to this event to which the WSO2 MI will subscribe.
- connection.salesforce.loginEndpoint:
- Login endpoint of the Salesforce account
- connection.salesforce.userName:
- Username for accessing the Salesforce account.
- connection.salesforce.password:
- Password for accessing the Salesforce account. Password in this field is a concatenation of the user password and the security token provided by Salesforce. For more information, refer security token.
- connection.salesforce.waitTime:
- Time to wait (in milliseconds) to connect to the Salesforce account
- connection.salesforce.connectionTimeout:
- Time to wait (in milliseconds) to connect to the client
- connection.salesforce.soapApiVersion:
- Version of the Salesforce SOAP API.
Deploy and Test
WSO2 Micro Integrator is required to have the Salesforce inbound endpoint JAR, hence download the JAR and copy to the lib directory which is under the WSO2 MI home folder (<wso2mi-home>/lib).
Build the integration project using Maven and copy the exported carbon application to the < wso2mi-home> /repository/deployment/server/carbonapps folder and start the integration server. If the credentials to connect to the Salesforce account are correct, once the server is started below log will be printed on successfully subscribed to the salesforce event object.
Since successfully subscribed, inbound endpoint will start polling and listen to any change events. Once there are events, such events will be consumed by the endpoint and send it to the configured sequence for further processing.
Below is an API call to update the phone number of an existing account in the Salesforce:
Once the above API call is successful, a change event will be triggered in Salesforce. Since WSO2 MI has subscribed to consume the change event, a log printed as expected in the WSO2 MI server of the consumed message:
In this scenario, a log has been printed and the message is dropped. This flow can be modified as required.
Event Processing with WSO2 MI and Salesforce Inbound Endpoint
With the WSO2 Salesforce Inbound Endpoint, you can integrate Salesforce in real-time with WSO2 MI, allowing for seamless interaction data synchronization. The inbound endpoint supports real-time event processing by listening to Salesforce events. This allows WSO2 to respond immediately to changes in the Salesforce. With features like event replay and coordination, the inbound endpoint ensures that your integration remains reliable and resilient, even in the face of network issues or system failures.
By leveraging the features of WSO2 Salesforce Inbound Endpoint, organizations can achieve efficient, reliable, and scalable integration solutions between WSO2 MI and Salesforce, enhancing their ability to respond to business events and streamline operations across their IT landscape.
Call to Action
Looking to integrate Salesforce events into your IT landscape in real time?
Discover how WSO2 Micro Integrator and the Salesforce Inbound Endpoint enable scalable, reliable integration.
Talk to our experts, we’ll help you get started.
