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

feat(outbox): add outbox storer with observability instrumented #63

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

igmagollo
Copy link
Contributor

What does this PR do

  • It inits the outbox pattern for Ent go
  • It adds a mixin that generates the outbox table
  • It adds the outbox storer, that is responsible to store messages using the EntClient
    • The storer receives a Table client and not the root client, e.g. entClient.OutboxMessage
    • The storer uses reflection to validate and call Ent functions due to the difficulty that Ent creates by generate the code on each repository. Also, Ent uses builder types with type recursion that makes the use of Generics very hard.
  • It adds observability to the storer:
    • Tracing: start spans to store messages
    • Metrics: count the total messages and the messages that result in error
    • Logging: Debug log with init and info log with number o messages stored and elapsed time
  • It adds unit tests on the pkg.Storer using a generated Ent client to ensure that the reflection is working properly.

What is comming next

After this feature, I'll start to work on the outbox Relay, that is a worker that read messages from the outbox and publish them to the message broker. I'll be interfacing the publisher to decouple this implementation from the message broker technology (e.g. RabbitMQ, Kafka, etc.). A strong candidate to help me with that is the package Watermill.

@TheRafaBonin TheRafaBonin merged commit 3b2aa5d into gothunder:main Dec 12, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants