Am in a design dilemma in choosing which would be the best approach in the Integration which we would be doing shortly.
To give a brief idea, the external system wants to send JSON data to SF. We would validate the JSON data and create a few sets of records.
So we have 2 options:
Using Apex Rest : The age-old world accepted Rest based Apex web services. It can do exactly what the API wants.
Using Platform Events : Event-Driven Decoupled Architecture having Messaging bus. This will involve sending JSON in Event's Custom Text area field and then parsing it in Event's trigger.
What should be the deciding factor, in what should be used for this Integration?
I have researched and came with few pointers.
Error/Exception Feedback to external System : Rest Api being Synchronous, can convey this back in the same transaction (realtime), Platform events being Async not so much(Might have to rely on emails/or create new platform error events that external systems will subscribe.
Retry : Yes we can have retry in platform events, but do we really need it here in this Integration? If its a Validation Exception or Nullpointer exception it will still be there no matter how many times you retry. The only advantage I see is If the exception is something like "UNABLE_TO_LOCK_ROW", in that case, yes retry functionality of platform events works, but here we are just inserting few records, so am pretty much sure that record locking wont be happening.
Replay Past Events : SF can't replay past events via trigger or flow/process.
Request JSON Size : Rest API can accept JSON till 6MB, whereas for Platform events its just 1MB,so Rest API can be used for more bulkified JSON records.
API calls and Event Limits : When I publish a platform event I am consuming 2 limits, 1 API calls to Publish events and Platform Events Hourly limit. Whereas in Rest API call its just API calls.
Can anyone point out the design consideration I am missing, plus what points I should consider in selecting the best approach.