For the current project, perform a microservice transformation, taking into account the following technical points:
-
Microservice architecture (BFF, Service, Admin, Job, Task modules)
-
API design (including API definitions, error code specifications, and usage of errors)
-
Use of gRPC
-
Go project engineering (project structure, DI, code layering, ORM framework)
-
Use of concurrency (parallel link requests with errgroup)
-
Use of microservice middleware (ELK, Opentracing, Prometheus, Kafka)
-
Cache optimization (consistency handling, pipeline optimization)
-
The ticket inquiry interface returns the following three items, which are provided by three different interfaces from two services (Shopping):
- Query the ticket price for a specific route and date (FareService.Pring)
- Return the lowest price calendar for a week before and after a specific route (FareService.PriceCalendar)
- Return tourist recommendations for the destination (Travel.Query)
-
The ticket inquiry interface belongs to the BFF layer, using errgroup to query the three interfaces. All three queries must succeed, and then the data is aggregated.
-
For ticket price inquiries, first query the cache. If not found, query the database, and then send a message to MQ to build a cache task.
-
Ticket price cache update job: consume the build task from MQ and fetch information from the DB to put into Redis.
- Ticket price, calendar, and travel recommendation interface design
- Inquiry service API design
- Database schema design
- Ticket price query implementation
- Calendar and travel recommendation implementation
- Cache update job
- Testing