Sync Vs Async
By default, Radical.sh generates synchronous APIs, where operations are executed directly on the database. However, users have the flexibility to modify this behavior to enable asynchronous APIs.
To enable asynchronous behavior, follow these steps:
- Add a model.
- Enable the API for the model.
- Choose one of the mutation operations: Create, Update, or Delete.
- Opt for asynchronous behavior.
Asynchronous functionality is established using Spring Cloud Stream with Kafka as the default binder. While it's possible to adapt this to a different messaging system, note that Radical.sh primarily supports Kafka.
Asynchronous operations generate an event that is subsequently consumed by the same service to execute the associated operation. Users have the flexibility to customize the event name to match the API's operation being executed.