Serves as a communication proxy for clients to expose information about long-running, resource-intensive processes.
Types of processes: data processing, report generation, or file uploads.
Every process may consist of separate tasks.
Key points:
Notifies the client when the process changes its status.
Any changes to the task status should be persisted in the database.
Users should be provided the ability to cancel the processes/tasks.
Error handling mechanisms should be implemented to deal with task failures and cancellations.
Endpoints:
Initiate Long-Running Task: Create an endpoint where clients can request the initiation of a long-running task. Upon receiving the request, generate a unique task ID, add the task to the queue, and return the task ID to the client.
Check Task Status: Create an endpoint that allows clients to query the status of a specific task by providing its task ID. Retrieve the task status from the database and return it to the client.
Cancel Task: Create an endpoint that allows cancellation of a specific task by providing its task ID.
Obtain task Details: Create an endpoint that would provide detailed information about a specific task, including metadata and progress information.
Webhook Callback: Create an endpoint that allows setting up a callback URL where clients want to receive notifications when tasks change their status. The API sends a POST request to the provided URL when the task is completed.
Notification Mechanism:
Set up a mechanism to notify clients when tasks are completed. This can be achieved through various methods such as:
No client-side polling should be used. Clients have to periodically query the status endpoint until the task is completed this is considered a resource-intensive approach.
Webhooks: Clients provide a callback URL where they want to receive notifications. The API sends a POST request to the provided URL when the task is completed.
WebSocket: Maintain an open connection between the server and client to push real-time updates about task status changes.
gRPC: Efficient and robust client-server communication by defining service contracts using Protocol Buffers (protobuf)
Message Queues: The producer would be part of your application that generates notifications and pushes them to the message queue. The consumer would be the component responsible for sending actual notifications to users.
Security:
Only authorized users who have permission can initiate tasks and access task information.
Testing
All the endpoints should be covered with tests.
Edge cases for error handling, security mechanisms, and task/process cancellation should be considered.
ProcessHub Monitor Service specifications
Serves as a communication proxy for clients to expose information about long-running, resource-intensive processes. Types of processes: data processing, report generation, or file uploads. Every process may consist of separate tasks.
Key points:
Notifies the client when the process changes its status. Any changes to the task status should be persisted in the database. Users should be provided the ability to cancel the processes/tasks. Error handling mechanisms should be implemented to deal with task failures and cancellations.
Endpoints:
Initiate Long-Running Task: Create an endpoint where clients can request the initiation of a long-running task. Upon receiving the request, generate a unique task ID, add the task to the queue, and return the task ID to the client.
Check Task Status: Create an endpoint that allows clients to query the status of a specific task by providing its task ID. Retrieve the task status from the database and return it to the client.
Cancel Task: Create an endpoint that allows cancellation of a specific task by providing its task ID.
Obtain task Details: Create an endpoint that would provide detailed information about a specific task, including metadata and progress information.
Webhook Callback: Create an endpoint that allows setting up a callback URL where clients want to receive notifications when tasks change their status. The API sends a POST request to the provided URL when the task is completed.
Notification Mechanism:
Set up a mechanism to notify clients when tasks are completed. This can be achieved through various methods such as:
Security:
Only authorized users who have permission can initiate tasks and access task information.
Testing
All the endpoints should be covered with tests. Edge cases for error handling, security mechanisms, and task/process cancellation should be considered.