Architechture Notes

Process stuck until success

If there is a message that fails to process (there will be an Exception). The Inbox Process will stop and always retry until success.

You should create an Alert (from Sentry, DataDog,...) and raise the error to your workspace (Slack, Teams, or anything else).

Mark it as P0 so the team can solve the issue with the highest priority.

The Inbox Process will be stuck until the issue is fixed.

This helps us to ensure data integrity, especially mission-critical applications. Your data will not be corrupted.

Why Inbox Process over Queue?

Queue is super easy to use, and built-in in Laravel. But there are several problems:

  • The msg ordering won't be 100% guaranteed, even though we can run the worker in 1 process only.

  • You have to build your own custom Idempotency Layer.

  • Using MQ (eg: SQS, even SQS-FIFO) won't be 100% guaranteed exactly-once. It can reduce.

    • We are talking about distributed server communication here (Two General problems).

  • Once your job is resolved, the job will be purged while Inbox will still keep them.

    • Helpful to tracing PROD issues, incident tracking,...

    • Inbox provides high visibility.

  • (Additional) Queue is tightly coupled to Laravel while the Inbox process can be used by any language or framework in general.

    • With Inbox, Laravel could stand alone as the exposed HTTP layer to collect msgs and defer the execution to other microservices.

Why relational databases over others?

  • It is like the default knowledge nowadays, everybody can get into it quickly.

  • Built-in & Supported by Laravel & PHP 100%, stable & battle-tested.

  • Perform ordering & locking are simple and efficient.

Could Inbox act as an Idempotency layer?

Yes, 100%.

Last updated