application architecture   refactoring to microservices   microservices adoption  

Example of extracting a service from monolith

For example, let’s imagine that the FTGO team wants to improve the efficiency of the business and customer satisfaction by rapidly iterating on the courier scheduling algorithm. It will be a lot easier for them to work on the delivery management logic if it’s a separate Delivery Service. To do that, the FTGO team must separate delivery management from order management and convert it into service.

Extracting the Delivery Service consists of the following the steps:

  1. Split the code and convert delivery management into a separate, loosely coupled module within the monolith
  2. Split the database and define a separate schema for delivery management.
  3. Define a standalone Delivery Service
  4. Use the standalone Delivery Service
  5. Remove the old and now unused delivery management functionality from the FTGO monolith

Before looking at each of these steps, let’s first review the AS-IS code.


Step 0: Review AS-IS code

In the FTGO monolithic application, Order management and Delivery management are intertwined as shown in this diagram.


Read more about the AS-IS architecture.


Step 1: Split the code

The first step is to split the code and convert delivery management into a separate, loosely coupled module within the monolith.


Read more about how the code is split.


Step 2: Split the database

The second step is split the database and define a separate database schema for the ftgo-delivery-service module.


Read more about splitting the database.


Step 3: Define a standalone Delivery Service

The third step of the refactoring process is to define a standalone Delivery Service and deploy it. The service does not, however, handle production traffic. Instead, it can, for example, be tested in production.


Read more about defining standalone Delivery Service.


Step 4: Use the standalone Delivery Service

The fourth step of the refactoring process is to use the standalone Delivery Service.


Read more about how to route production traffic to the Delivery Service.


Step 5: Remove the delivery management functionality from the FTGO monolith

The fifth step of the refactoring process is to remove the now obsolete delivery management logic from the monolith.


Read more about removing the obsolete code.



application architecture   refactoring to microservices   microservices adoption  


Copyright © 2024 Chris Richardson • All rights reserved • Supported by Kong.

About Microservices.io

Microservices.io is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action, the creator of the original CloudFoundry.com, and the author of Microservices patterns.

ASK CHRIS

?

Got a question about microservices?

Fill in this form. If I can, I'll write a blog post that answers your question.

NEED HELP?

I help organizations improve agility and competitiveness through better software architecture.

Learn more about my consulting engagements, and training workshops.

LEARN about microservices

Chris offers numerous other resources for learning the microservice architecture.

Get the book: Microservices Patterns

Read Chris Richardson's book:

Example microservices applications

Want to see an example? Check out Chris Richardson's example applications. See code

Virtual bootcamp: Distributed data patterns in a microservice architecture

My virtual bootcamp, distributed data patterns in a microservice architecture, is now open for enrollment!

It covers the key distributed data management patterns including Saga, API Composition, and CQRS.

It consists of video lectures, code labs, and a weekly ask-me-anything video conference repeated in multiple timezones.

The regular price is $395/person but use coupon NPXJKULI to sign up for $95 (valid until December 25th, 2024). There are deeper discounts for buying multiple seats.

Learn more

Learn how to create a service template and microservice chassis

Take a look at my Manning LiveProject that teaches you how to develop a service template and microservice chassis.

Signup for the newsletter


BUILD microservices

Ready to start using the microservice architecture?

Consulting services

Engage Chris to create a microservices adoption roadmap and help you define your microservice architecture,


The Eventuate platform

Use the Eventuate.io platform to tackle distributed data management challenges in your microservices architecture.

Eventuate is Chris's latest startup. It makes it easy to use the Saga pattern to manage transactions and the CQRS pattern to implement queries.


Join the microservices google group

Topics

Note: tagging is work-in-process

Cynefin   ·  DDD   ·  GitOps   ·  Microservices adoption   ·  ancient lore   ·  anti-patterns   ·  api gateway   ·  application api   ·  application architecture   ·  architecting   ·  architecture   ·  architecture documentation   ·  assemblage   ·  automation   ·  beer   ·  books   ·  build vs buy   ·  containers   ·  culture   ·  dark energy and dark matter   ·  decision making   ·  deployment   ·  deployment pipeline   ·  design-time coupling   ·  developer experience   ·  development   ·  devops   ·  docker   ·  eventuate platform   ·  fast flow   ·  generative AI   ·  glossary   ·  health   ·  hexagonal architecture   ·  implementing commands   ·  implementing queries   ·  inter-service communication   ·  kubernetes   ·  loose coupling   ·  microservice architecture   ·  microservice chassis   ·  microservices adoption   ·  microservices rules   ·  microservicesio updates   ·  modular monolith   ·  multi-architecture docker images   ·  observability   ·  pattern   ·  pattern language   ·  refactoring   ·  refactoring to microservices   ·  resilience   ·  sagas   ·  security   ·  service api   ·  service architecture   ·  service blueprint   ·  service collaboration   ·  service design   ·  service discovery   ·  service granularity   ·  service template   ·  software delivery metrics   ·  success triangle   ·  survey   ·  tacos   ·  team topologies   ·  technical debt   ·  testing   ·  transaction management   ·  transactional messaging   ·  wardley mapping

All content


Posts

20 Mar 2024 » A tour of two sagas
21 Dec 2023 » Thoughts about team size
24 Jul 2017 » Revised data patterns