AxonFramework / AxonBank

Simple virtual bank application to showcase features of Axon Framework
Apache License 2.0
187 stars 116 forks source link

Using Axon/CQRS-ES as full architecture #9

Closed fortm closed 2 years ago

fortm commented 7 years ago

Hi

I am working on converting an existing application to CQRS design using Spring and Axon in this effort. Initially I started with below link following webinar and it all makes sense. It seems as if I can split my whole application into command and read and then have separate java processes. The web part is taking care of responding to client which in my case is apollo server running graphql.

AxonBank

I also came across below sample, which is very similar to AxonBank example, with 3 additional microservices for discovery, config and gateway. This also does not try to centralize web into one java process, instead read and write REST requests reach to separate java processes. Axon microservice sampler

Finally I came across this article which says that cqrs should not be full architecture and only saga should be aggregates. I think this means that from AxonBank example, BankAccount does not qualify to be an aggregate here and only BankTransfer since later is a saga. Also will SOA in below quote qualify to be same as microservices ? If we structure CQRS around microservices, then each microservice will have their own query/core counterparts ..So that means 5 microservices will have doubled ie 10 further sub processes for read/write each. http://udidahan.com/2011/04/22/when-to-avoid-cqrs/

Here’s the strongest indication I can give you to know that you’re doing CQRS correctly: Your aggregate roots are sagas. Also, CQRS should not be your top-level architectural pattern – that would be SOA. CQRS, if used at all, would be used inside a service boundary only.

There is also this reference where it seems saga is the usecase cited for CQRS http://joshlong.com/jl/blogPost/an-email-on-distributed-state.html

The microservice only knows about the data in its domain, of course, so we need to solve the problem of composing data from different sources in a transactional way. CQRS is a logical fit here, especially with event sourcing.

In my case, existing application is fairly big with around 200 entities and there are definite bounded contexts inside it like posts, groups, profile, jobs, settings, payment, accounts, forums etc.. Would you prefer structuring java processes in the way AxonBank does or the microservice-sampler approach or the way last 2 citations ?

Sorry if I am asking the obvious but found this bit confusing since I started working on CQRS conversion.

fortm commented 7 years ago

I think this one is closest to how we can structure for microservices.

micro-company

smcvb commented 2 years ago

Hi @fortm, I'd like to extend my apologies for the tremendous radio silence you have experienced here. Back in the day, AxonIQ's efforts were rather stretched thin and we sadly missed this issue from you.

The sample project you share from @idugalic (who now works for AxonIQ) is indeed a clear sample of how to construct an Axon application.

Now, the reason I'm commenting though is that I'm closing this issue due to inactivity. Furthermore, this sample project this being archived, so we're not planning any active development on this anymore.

If you're looking for a sample project from AxonIQ, I recommend the GiftCard or Hotel applications.