I have a system that's part of an event-driven architecture. Need some advice on refactoring

I have a system that was built 5 years ago. It's part of a multi-system event driven architecture. And each system is owned by a different team with varied responsibility. When the system was initially built, it was done in less than ideal way and as complexity grew, time taken to implement new features are getting longer and longer. In an effort to refactor the application, we have decided to use DDD and refactor our service to a modular monolith. While doing so, I have hit a point of doubt and I need some advice on how to proceed. In our workflows, we have a lot of use-case where we read data(entity/aggregate root) from DB, make an external call to gather new data and update it back to DB. Since I don't want to put the API call inside my transaction( read from db and update entity) I am thinking of having breaking the flow into following steps. Read model from DB (just read the required data to call external API) Call external API Load and update the entity with newly acquired data Doing so I'll be slowing introducing CQRS pattern. Since I have not worked in this architecture before I have a couple of questions. Is this the right approach to take? I have read that this is notoriously hard to implement and difficult to maintain? I know I might have provided a vague context and asking too many direct answers. Please let me know if I need to provide better context? I am using Java, Spring Boot.

Jun 5, 2025 - 18:00
 0

I have a system that was built 5 years ago. It's part of a multi-system event driven architecture. And each system is owned by a different team with varied responsibility.

When the system was initially built, it was done in less than ideal way and as complexity grew, time taken to implement new features are getting longer and longer.

In an effort to refactor the application, we have decided to use DDD and refactor our service to a modular monolith.

While doing so, I have hit a point of doubt and I need some advice on how to proceed.

In our workflows, we have a lot of use-case where we read data(entity/aggregate root) from DB, make an external call to gather new data and update it back to DB.

Since I don't want to put the API call inside my transaction( read from db and update entity) I am thinking of having breaking the flow into following steps.

  1. Read model from DB (just read the required data to call external API)
  2. Call external API
  3. Load and update the entity with newly acquired data

Doing so I'll be slowing introducing CQRS pattern. Since I have not worked in this architecture before I have a couple of questions.

Is this the right approach to take?

I have read that this is notoriously hard to implement and difficult to maintain?

I know I might have provided a vague context and asking too many direct answers. Please let me know if I need to provide better context?

I am using Java, Spring Boot.