agola-io/agola

notification service: save webhook and deliverys

alessandro-sorint opened this issue · 2 comments

Describe solutions for issue #339

The notification service should
1 save the webhook and the delivery
2 the notification service trigger the delivery and send the webhook
3 update the delivery: change the status to delivered or delivery_error if the sending failed and save some log informations

It is needed to add 2 table:

  • RunWebhook: it contains the payload of the webhook
  • RunWebhookDelivery: it is populated when a run event occour and trigger by the notification service sendind the webhook to the client. It contain a sequence, RunWebhookID, DeliveryStatus can have values delivered(client received the webhook), not_delivered(the notification service have to elaborate it and send the webhook), delivery_error(somthing is wrong in the delivery for the example the client was offline), and some log data about the delivery DeliveredAt, Duration, Status, StatusCode
sgotti commented
  • Please better explain in the issue description that you're going to create two tables in notification service.

  • Why are you saving the webhook delivery status in webhook when you already have also a webhookdelivery?

    • Additionally if you're going to give the ability to (re)deliver the webhook multiple time it doesn't makes sense for the webhook to have a delivered status.
  • Please better explain in the issue description that you're going to create two tables in notification service.

  • Why are you saving the webhook delivery status in webhook when you already have also a webhookdelivery?

    • Additionally if you're going to give the ability to (re)deliver the webhook multiple time it doesn't makes sense for the webhook to have a delivered status.
  • I updated the description
  • my idea about the webhook delivery status(table RunWebhookDelivery) is to undertand if the delivery is completed(well or wrong)
  • Delivered(table RunWebhook) is set true when the delivery status is done correctly. If false the retry logic can create a new delivery and try to resend the webhook