Fire and Forget (Integration design pattern)

In this integration pattern, Salesforce calls the remote system, but doesn’t wait for the call’s successful completion.

Solutions:

  • Process-driven platform events (Best Solution):

No customization is required in Salesforce to implement platform events. This is the recommended solution when the remote process is invoked from an insert or update event.

External apps can listen to event messages by subscribing to a channel through CometD. Platform apps, such as Visualforce pages and Lightning components, can subscribe to event messages with CometD as well.

  • Customization-driven platform events (Good Solution):

Similar to process-driven platform events, but the events are created by Apex triggers or classes. You can publish and consume platform events by using Apex or an API.

  • Workflow-driven outbound messaging (Good Solution):

No customization is required in Salesforce to implement outbound messaging. The recommended solution for this type of integration is when the remote process is invoked from an insert or update event. Salesforce provides a workflow-driven outbound messaging capability that allows sending SOAP messages to remote systems triggered by an insert or update operation in Salesforce. These messages are sent asynchronously and are independent of the Salesforce user interface.

The outbound message is sent to a specific remote endpoint. The remote service must be able to participate in a contract-first integration where Salesforce provides the contract.

On receipt of the message, if the remote service doesn’t respond with a positive acknowledgment, Salesforce retries sending the message, providing a form of guaranteed delivery. When using middleware, this solution becomes a “first-mile” guarantee of delivery.

Note: If session id is passed, remote system can reuse that session id and perform some extra operation like read related child records from salesforce.

Click this to know more about outbound messaging.

  • Custom User Interface or Trigger or Batch Apex (Suboptimal Solution):

This solution is typically used in user interface-based scenarios, but does require customization. In addition, the solution must handle guaranteed delivery of the message in the code.

Similar to the solution for the Request and Reply pattern solution but the difference is that in this pattern, Salesforce doesn’t wait for the request to complete before handing off control to the user.

After receiving the message, the remote system responds and indicates receipt of the message, then asynchronously processes the message. The remote system hands control back to Salesforce before it begins to process the message; therefore, Salesforce doesn’t have to wait for processing to complete.

For all Design Patterns, please refer this.

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply