I'm working on a relatively large system, that is about online transportation reservation. The system is decomposed into some services, that are interacting via REST interface with each other and the UI.
I have a service, called
BillingService, that is responsible for establishing, payment and finalization of bills. Each bill can consist of different reservations, like flight, train, bus, etc. Each of these items have a completely different business logic, procedure and models, and each of them is managed in a different service, and
BillingService is playing an orchestration role between them.
We have a panel for our customers and operators, to see the list of their bills, and reservations inside it. Each reservation has its special details that must be fetched from the respective service, and bill service has no idea about that.
Now, assume that in the middle of the day, the operator's panel is filled with more than 40 bills, each having some reservation items, and its status must be updated in real time. Currently we are using an SQL query to join bills table with reservation tables and return the result and it is a fast and straight-forward action, but obviously, it is in conflict with the principle of single responsibility of
BillingService. The right solution (from the design point of view) would be to fetch reservation details from their services, but its performance and response time will not be acceptable, as we have to issue hundreds of requests to the reservation services to get details.
As we are planning to add more types of reservation (that have the same criteria as others) to the system, the current design (accessing reservation database directly in
BillingSerice) seems like a headache now, and the other way (fetching reserve details from their services) seems not be practical, because of large amount of communication and requests that are involved.
Is there some solution that considers performance and design simultaneously, that I'm not seeing?