App tasks
Apps can register tasks that will be executed by Rimdian at a specific interval or manually. This is useful for running background jobs, such as importing or exporting data to an external system.
A task can spin up to 10 workers running in parallel. The worker 0
is the main worker and the others are secondary workers. The main worker is the one that will be called when the task is launched.
Each worker has a JSON state, that can be used to store anything you need to keep track of the task progress.
When a task is launched, your app webhook_endpoint
will be called with the following payload:
The response payload to the webhook allows you to:
- Mark the worker as done or not
- Return a message (optional)
- Return an error (optional)
- Update the current worker state (optional), useful to keep track of the worker progress (pagination…)
- Mutate the app state (optional)
- Return a list of data items to import to the Collector (optional)
- Delay the next job (optional), useful if you interact with external systems that have rate limits like the Amazon Seller API
The webhook will timeout after 20 seconds.
Example of a response for a job that is not yet done before 20 secs: