Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Webhook Support for Task Queue #178

Open
movchan74 opened this issue Sep 16, 2024 · 0 comments
Open

[FEATURE REQUEST] Webhook Support for Task Queue #178

movchan74 opened this issue Sep 16, 2024 · 0 comments

Comments

@movchan74
Copy link
Contributor

Feature Summary

Implement webhook functionality for the task queue system, allowing users to receive task status updates without having to poll the /tasks/get/{task_id} endpoint.

Justification/Rationale

  • Reduced Polling Overhead: By enabling webhooks, users won’t need to continuously poll the task status endpoint. This reduces server load, unnecessary API calls, and network traffic.

  • Timely Notifications: Users can receive immediate updates on the task status (e.g., when a task is completed or fails), leading to better automation and workflow efficiency.

Proposed Implementation (if any)

  • Webhook Subscription:

    • When deferring a task using defer=True, users should be able to provide a webhook_url as an additional query parameter. This URL would be stored along with the task and used to send webhook notifications when the task status changes.
    • Example API call:
      POST /some-endpoint?defer=True&webhook_url=https://example.com/webhook-handler
  • Event Trigger:

    • When a task changes status (to "completed" or "failed"), the system should trigger a POST request to the registered webhook URL.
  • Payload Structure:

    • Send a simple JSON payload with the status and task information. An example payload:
    {
      "task_id": "{task_id}",
      "status": "completed", // or "failed"
      "timestamp": "{timestamp}"
    }
  • Failure Notifications:

    • If the task fails, the webhook should notify the user by sending a status of "failed" with additional error information.
  • Retry Mechanism:

    • Implement a retry mechanism for webhook delivery in case the receiving server is down or unreachable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant