novuhq / novu-php

PHP SDK for Novu - The open-source notification infrastructure for engineers. :rocket:
https://docs.novu.co/sdks/php
MIT License
85 stars 23 forks source link

Add Exponential Retry Mechanism with Idempotency Headers #57

Open Cliftonz opened 11 months ago

Cliftonz commented 11 months ago

In order to enhance the resilience and reliability of our SDK, we would like to introduce an Exponential Retry mechanism for retrying failed requests. Additionally, to ensure the idempotent processing of requests, it's vital to incorporate support for providing an Idempotency Key as per the draft specified in the HTTP Idempotency Key Header Field.

The key requirements for this implementation include:

  1. Exponential Retry Mechanism:

    • The SDK should retry failed requests following an exponential backoff strategy to minimize the contention and impact on the systems involved.
    • The SDK should ensure that the retry mechanism is configurable (e.g., max retries, initial delay, maximum delay).
  2. Idempotency Key Provisioning:

    • The SDK should allow for either automatic or manual provisioning of an Idempotency Key for each request.
    • The Idempotency Key should conform to either CUID, ULID, or UUID formats as specified in the draft.
    • The Idempotency Key should be included in the HTTP Header as Idempotency-Key and following the standards outlined in the draft.
  3. Configuration and Documentation:

    • The SDK should provide configuration options for enabling/disabling the Exponential Retry mechanism and Idempotency Key provisioning.
    • Comprehensive documentation should be provided explaining the configuration options, operational behavior, and the benefits of using the Exponential Retry mechanism along with Idempotency Keys.

Acceptance Criteria:

Update: You can reference the go-lang library to keep the method signature and configuration the same. https://github.com/novuhq/go-novu/pull/62

Please refer to the draft for further details on the HTTP Idempotency Key Header Field and ensure adherence to the specified standards while implementing this feature in the SDK.

dammy001 commented 10 months ago

@Cliftonz I'm working on this.

unicodeveloper commented 10 months ago

Please, did you ask to be assigned to this?

On Thu, Oct 19, 2023 at 7:32 AM Anjorin Damilare @.***> wrote:

@Cliftonz https://github.com/Cliftonz I'm working on this.

— Reply to this email directly, view it on GitHub https://github.com/novuhq/novu-php/issues/57#issuecomment-1770149557, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWPNUM32BDIKSZAMYPKX4LYADCRNAVCNFSM6AAAAAA5WJBI6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZQGE2DSNJVG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

unicodeveloper commented 10 months ago

I can see that you have a draft PR up @dammy001. So I'll assign you to the issue.

For next time, please ask to be assigned so that multiple folks are not working on the same thing at the same time.

dammy001 commented 10 months ago

I can see that you have a draft PR up @dammy001. So I'll assign you to the issue.

For next time, please ask to be assigned so that multiple folks are not working on the same thing at the same time.

@unicodeveloper Yeah, thanks.