I have a design question and I want an expert opinion from the group.
Here is the use case:
- Whenever there is any update on the
Booking
record (let's say change thestatus
to "Cancelled
"), I want those records to be updated in another system. They have their table to store these updates. - It has to be real-time. So as soon as a record(s) are updated we will update their system.
- It should work for the single record as well as multiple records (let's say 100K records)
Solution 1:
I can introduce streaming API
and let the other system subscribe to it and on any update, they can get the payload and work on it. But I am not sure how efficient this would be when we work on 100K booking records at the same time.
Solution 2:
We can call a future(callout = true)
method from the trigger
. I am not sure how efficient that solution would be when I am working with 100K records simultaneiusly. We have a limitation of 100 callouts per transaction using the asynchronous code. I know we can solve this by using EnqueJob Interface
too, but I am not sure how can we fit EnqueJob
here.
What would be the best approach to work with a large number of data in Salesforce? I am more interested to solve it with Solution 2.
I would really appreciate any example with a pseudo-code that would help me understand the concept quickly.