jeudi 23 janvier 2020

Event sourcing, CQRS with Axon Server / Framework - Event Sourcing the entire application a good idea?

This question is very loosely related to Axon Server / Framework, since I'm learning it specifically while studying and trying to get into learning how to build microservices. Since it's difficult to learn about all the architectural patterns without actual hands on experience (and difficult to get hands on experience to begin with without a large application to actually test/build with), I'm theorizing a lot here (my questions might just be plain stupid, sorry, I'm still learning).

I downloaded Axon Server and successfully built and ran the included giftcard demo in three separate microservices. It works great, I see the events and all that on the Axon Dashboard, but I can't help but think about the "what ifs" of if I really built a very large enterprise application.

Consider this :

I'm building a streaming platform like Twitch. There are the basic, obvious services such as Customer service with its profile data, an order service (for subscriptions, donations), etc.

But there are other services such as the chat system. Hypothetically, I feel like event sourcing a chat system would be pretty beneficial, because you would have timestamps built in for replaying the chat if viewers are watching a VOD. However, I also feel like I shouldn't be mixing events for a chat system with an event store that deals with transactions; the two are completely separate systems and just storing every event from every service in a single event store feels... Monolithic?

I'm still unclear what the best practices are. All the samples and examples from talks always show very simplistic systems with the typical Customer, Order, Item aggregates and doesn't go into detail how this simple application would grow to a large service like Twitch.

So my questions are,

1) Should you event source an entire application, or can you choose which ones to event source and not?

2) Does Axon Server support two different event stores, such as one for a chat system and one for other services? Would I just run two different instances of Axon Server in this case? Should an application ever have two different event stores, or do I dump every event into a single event store, regardless of if something like a chat system sending far more events than anything else (would event sourcing a chat system even be a good idea, given the use case that I specified where viewers might want to "replay" the chat log?)?

3) The whole idea of a single event store being the single source of truth feels monolithic. Am I wrong in thinking this, and if I'm not, what are the ways to circumvent this if I had a really large application?

Aucun commentaire:

Enregistrer un commentaire