Skip to content

WIP: PoC Decouple domains with Gitlab::EventPublisher

Fabio Pitino requested to merge poc-event-publisher into master

TODO

  • create issue describing the problem to solve
  • create specs

Problem

GitLab-Rails codebase presents domain models that are highly coupled with each other. There are a number of initiatives that focus on decoupling domains within the codebase.

One aspect of this coupling is managing side-effects when a particular event happens. Currently when an event E occurs in a component A, the side effects are managed by A which couples it to B if this must react to E. Vice-versa, when B generates an event that causes A's state to change, it's B that invokes directly the status change in A.

This method may make sense when A and B are strictly coupled and operate in the same bounded context. If this is not the case this contributes to raise the complexity of the code.

What does this MR do?

This is a PoC that attempts to define a simple publish-subscribe mechanism to decouple domains using Event-driven Architecture.

To do that we leverage our existing infrastructure using Sidekiq workers and provide a way to define events and register listeners to them.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports