Microservices-based Taxi App
Java services help to boost the functionality of the app and prevent it from becoming monolithic and overloaded with the time.
The customer wanted to order a taxi-hailing platform development. One of the requirements was to make it cross-platform (operate either as a web application or as a phone app). The standard functionality was required: order a taxi, track the cab, make the payment, receive notifications, leave commentaries.
On the stage of analysis, SCAND development team performed the decomposition of the task and concluded to introduce such components as passenger management, driver management, trip management, dispatcher, payments, notifications, billing.
Each of the components has clear boundaries and is a perfect fit to be implemented as an independent microservice. The aim of the passenger service is to store/update the passenger data. Trip management service is in charge of the creation/processing of the data concerning taxi trips. The payment component controls the bills and the fare received after the trip is done. UI for browsers and smartphones was considered a separate microservice.
The development process was organized in the way that a dedicated team was assigned to work on a single service with a focus on the topic and generate relevant knowledge. The team has to perform well to meet the customer’s requirements in the best possible way and build a robust microservices architecture pattern.
Every service provides its own API which could be used by others. The dedicated teams were cooperating with each other in terms of exchanging the APIs and the requirements specified for their services. Most services use REST as a synchronous, request/response-based inter-process communication mechanism and JSON as the message format. For example, trip management microservice calls the passenger service to verify that the account is active using the aforementioned mechanism. Asynchronous publish/subscribe interaction (when a new trip is created) is organized between Trip Management and Dispatcher. The latter allows locating an available driver. To realize the mentioned above interaction Apache Kafka (a messaging system with a Java client) was used.
Grails 3 (a powerful Groovy-based framework for the JVM) was selected for the implementing part of the services. It has a great support potential for microservices as it provides the mechanisms for exposing REST API, parsing JSON, sending HTTP requests using RestBuilder. Groovy language adds a lot of syntactic sugar on top of Java to make the development process easier. Developers focus on the implementation of business logic rather than writing the boilerplate code. However, the services with high-performance requirements were written in Java using Spring Boot.
Client applications (browser or smartphone) don’t send requests to the services directly but only through API Gateway. We implemented it in RxJava to allow the performance of multiple independent requests concurrently.
Being able to interact with other services in the distributed system environment, the service needs to “know” the location of other services. Apache ZooKeeper is used as a service registry and as the database of available service instances. Services use Java client to connect to Apache ZooKeeper to track the network location of the microservices.
Highly efficient and flexible application having a cross-platform nature.
SCAND development team built numerous microservices using Java Ecosystem to develop a highly efficient and flexible application having at the same time a cross-platform nature. The interface of the application is easily extendable run either on Desktop or on smartphones. The Java-based microservices help to boost the performability of the app and guarantee the ‘working life’ extension.