Salesforce Streaming API Integration using Mule ESB

17.06.2014

Overview

As one of the most widely used Customer Relationship Management solutions on the market, Salesforce CRM plays a central role in the most critical business processes for many companies. In order to fully automate and optimize these business processes, companies need to integrate Salesforce CRM with other applications within their organization. This article discusses Salesforce CRM integration with other applications like SAP, e-POS, e-Commerce SharePoint etc. including uses and benefits, challenges, and new approaches. Salesforce CRM has been widely used in organizations as part of managing their customer interactions. However, Salesforce with the Cloud Delivery model has become difficult and expensive for the organizations to custom code their integration of Salesforce with their existing on premise systems. Many organizations have a need for this integration in a cost and time effective way to automate their business processes.  As a solution to this problem, WHISHWORKS has a way to integrate the company’s existing systems with Salesforce using a modern, lightweight and low cost Mule Enterprise Service Bus.

Mule ESB - The Best Way to Integrate Salesforce

WHISHWORKS has extensive experience utilizing the Mule ESB Anypoint Salesforce Connector to connect directly with Salesforce APIs. This connector enables users, access to full Salesforce functionality with seamless Salesforce integration. In a business scenario, where there was a requirement to get the updated details of the Customer from Salesforce and make it available in other system in real time without increasing the Salesforce development code. WHISHWORKS has implemented an effective way of integrating with the Salesforce using Streaming API.

 SAP 1

Mule ESB Salesforce Connector

The Salesforce Mule connector establishes connection to Salesforce system using SOAP web service (provided by Salesforce). Almost every operation that can be done via the Salesforce's API can be done thru this connector. This connector will also work if your Salesforce objects are customized with additional fields or even you are working with custom objects. The Connector supports the option to configure Salesforce connection details, connection pooling and max limit of active connections.   The Salesforce Streaming API is a simple way to push relevant data to your users in real-time, instead of having to refresh the screen to get new information. This allows a user to get information without having to perform any action to retrieve it, essentially pushing new data to the screen.   The Streaming API uses a publisher subscriber (pub/sub) model to push data to the client. The first thing a developer must do is set up a PushTopic in Salesforce. This is basically a query that watches for changes in values of certain fields in a Salesforce Object. Then the client can subscribe to that PushTopic and receive updates whenever a change is made to the specified fields.  This is done using a push protocol called the Bayeux protocol.  The Salesforce implementation uses long polling connections to the server that will be able to notify the client on changes.  This differs from traditional polling in that it keeps an incoming request open until an event is fired and then sends the response. Here's how this works.  An http request is made to the server. Instead of responding immediately, the server keeps the request and waits for a specific event to fire, in our case a change in one of the fields of our PushTopic object.  When the event is fired a response is made. Then the client makes another request to the server which it keeps open and waits. This ends up looking something like this:

 SAP 2

Create a PushTopic in Salesforce

The easiest way to do this is to either use the workbench at developerforce.com or the developer console. I'm going to use the developer console. In the console head to Debug -> Execute Anonymous Apex Code.  We are essentially creating a SOQL query with a few extra parameters that watch for changes in a specified object. Note we have added a Name so that we can subscribe to this specific topic, and we are only got notifications on the 'Update' operation.  If you were to choose 'All' it would notify every time one is created, or an update is made to any of the fields in your query Below example shows the push topic is created on the Salesforce Account object and whenever the Account object is updated, this PushTopic will publish an update to Mule ESB via Mule Salesforce Connector.

How to get Push topic notification in Mule

Refer to the following ppt: Salesforce.pptx

High level architecture to Integrate Salesforce using Mule Enterprises ESB

 

SAP 3

Benefits to the customer

When Salesforce is properly integrated with other applications, companies are able to streamline and fully automate their business processes. Companies further benefit from Salesforce integration in the following ways:

  • Increased Business Alignment: The ability to create an integrated agile software infrastructure for changing business needs
  • Better Business Efficiency: The ability to streamline, automate, and enable a better tracking and visibility to business processes
  • Improved Business Visibility: Ability to integrate systems and to aggregate data for a consistent and accurate view of business as a whole
  • Significant cost savings by using low cost Mule ESB Enterprise
  • Support for functional and non-functional requirements
  • Ability to generate reports in Salesforce based on Customer and evaluate the sale across the world
  • Improved customer interactions by automating direct communications
  • Elimination of the need for dual data entry, saving time and money
  • Fewer data redundancies and errors caused by manual data entry
  • Enhanced agility to act on new information quickly

Salesforce Integration Challenges

Although integration has been around for well over a decade, the specific challenge of integrating Salesforce with other system emerged much more recently. Moreover, traditional approaches to integration have been costly and complex. Direct, point-to-point integration, for instance, has been utilized in some cases as a quick, adhoc solution to Salesforce integration challenges. However, such an approach creates tight dependencies between the two systems, resulting in a brittle environment and a progressively more complex architecture as new integration is added over time. 

Author: Mr. Sanjeet Pandey is a Masters of Computer Application (MCA) graduate having 4+ years of experience as a Technical Specialist with WHISHWORKS. He has varied experience in ESB’s like Mule, JCaps.  Sanjeet loves dreaming up new ideas, movies & music, photography & travelling and developing web projects. To know more about Sanjeet log on to www.sanjeetpandey.com

If you would like to find out more about how APIs could help you make the most out of your current infrastructure while enabling you to open your digital horizons, do give us a call at +44 (0)203 475 7980 or email us at marketing@whishworks.com

Other useful links:

WHISHWORKS Systems Integration

API Recipes with MuleSoft Anypoint Platform

Case studies 

 

Recent Posts