How does the Fire-And-Forget pattern optimize asynchronous processing during high-volume outbound data transfers?
Answer
Basics: Instead of blocking on the remote system, Salesforce hands off the work: it publishes an event, sends an outbound message, or enqueues an async job that performs the callout later. Use it for notifications, order submissions or data pushes where the user does not need the result immediately. The trade-off is that you only get "accepted for delivery", not the final outcome.
How it works:
- Record change in Salesforce.
- Publish a platform event (
EventBus.publish) or Change Data Capture event, create an outbound message, or enqueue Queueable/@future(callout=true). - A subscriber (middleware via Pub/Sub API or CometD, or an Apex/Flow trigger) delivers it to the target.
- The target acknowledges delivery to the bus; any real result comes back later via a Remote Call-In (callback) if needed.
Advanced / deep dive: Delivery is at-least-once, so consumers must be idempotent (carry a unique key such as the record Id plus version). Ordering is by ReplayId within a channel, not guaranteed globally. Events published "after commit" disappear if the transaction rolls back, which keeps data consistent; "publish immediately" events survive rollbacks, which suits logging. Platform event publishing and delivery are governed by allocations (hourly publish and 24-hour delivery limits that depend on edition and add-ons; verify in current limits docs). Queueable chaining allows only one child per running job, so high-volume outbound work usually goes through events plus middleware, which can batch, retry and throttle. Fire and Forget does not remove error handling: you still need monitoring and a dead-letter strategy for messages that never get processed.
Code / config example:
List<Order_Submitted__e> events = <Order_Submitted__e>();
(Order o : orders) {
events.add( (Order_Id__c = o.Id, Payload__c = JSON.serialize(o)));
}
List<Database.SaveResult> results = EventBus.publish(events);
(Database.SaveResult sr : results) {
(!sr.isSuccess()) { }
}