From Ruby on rails to event driven micro apps

From Ruby on rails to event driven micro apps at Fiverr

Persistence

Messaging

Rabbitmq and Kafka

Deployment

The monolith

Problems

The chimera

A Fiverr template for

  1. Rest endpoint for synchronous reads
  2. Rabbitmq for asynchronous writes

The writes posts to an endpoint that validates, which puts the messages into mongoDB as a message hospital in case write fails, and then rabbitmq writes to the DB

Benefits

Problems

Bounded contexts

Approach 1

Share database between services

Approach 2

Pull data push command

Approach 3

Event driven - domain events

BUT

CQRS

Command query responsibility segregation

Kafka

Producer and consumer

State change events

Examples

GigDescriptionUpdated good
GigUpdated bad

Fine grained

Protobufs

Event sourcing

Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data. The store acts as the system of record and can be used to materialize the domain objects.

Producing and consuming your own writes for consistency

Result

Presentation layers

Conclusion

Not there yet: