Part two - Moving towards Microservices
The Travel Agency Demo showcase a business process for a user to request a holiday itinerary, it'll look up the available flight and hotel, and booked the flight and hotel respectively, if the credit card is invalid, it will cancel the booking. The original application was in JavaEE, everything is all packaged and wrote in the same package. It'll face the problem when it tries to scale-up any of the services.
During the re-construction , I want to make sure it does not impact the original business flow. So it's provide the same services as it is. OK, now we start moving to microservice. First of all, breaking down to smaller pieces, because Flight and Hotel are in nature different services, so I separate them in two. In the application, it has web service endpoints to talk to BPM Suite or other client, and at the backend, the available data and booking data are stored in a Database. In between front and backend, I decide to make the communication async, so it's easier to scale-out and make sure it's absolutely decoupled, and language independent.
For backend, it needs to provide 3 different functionality,
- Recommend 1 available Flight/Hotel
- Book and record Flight/Hotel
- Cancel previous booking of Flight/Hotel

It is very easy for people to over-do the microservice, for me it's not all about breaking down service to make it do one thing per service, but to make it easier for developer to maintain and make sense logically. But what if one day booking and cancellation needs to separate? Don't worry, one thing JBoss Fuse is great to implement microservice is the way we can break different functions into different Camel routes. So when it's time to separate them, it's simply the matter of moving the route to another project.
(Project contains 2 routes, booking and canceling)
(Booking route)
(Cancel Booking route)
This is how I move the monolithic application to a more microservice approach. Now it's going to be much easier to scale out, and the application will have less impact to other application if anything goes wrong. From the diagram, you can see now, we can add a gateway in front to dispatch loads to the two containers listening and waiting for incoming request, and have messaging broker to serve as another layer of buffer.
OK, enough of the architecture talk, next time, we'll take a look at how to migrate web service to JBoss Fuse. (Contract-first Web Service in Camel).
For more detail side in BPM Suite, please click here to Eric Schabell's post.
Micro Services Migration Story with JBoss BPM Travel Agency
Part One: Introduction and Installation
Part Two: Moving towards Microservices