Good day. I will try to describe the task: there was a big project on JAVA, over time the project grew even more and it was getting harder to make changes to the monolithic application. Then it was decided to take part of the functionality to the “services” with which the kernel will communicate via REST, but at the same time, the services executing the adopted logic directly addressed the kernel database for writing and reading data. That is, these are not services, but simply a part of the business of logic outside the monolithic core. Over time, the idea emerged to make the so-called services more independent and to begin by blocking the possibility of direct access to the data.
Data access was divided into 2 categories:
modification (it was decided to do through events and message buses (broker))
Read data. And here the question arose how best to do it. While 3 options come to mind:
2.1. leave the possibility for services to read data directly from the database
2.2. do internal api methods on the kernel side (I don’t want to, since you don’t need to touch the kernel once)
2.3. wrap the sql query built in the service into some object, send it to the http kernel with a query, already in the kernel check that it is select, execute and return the answer back to the service in the form of a json array. And the service already has it parked into a normal list of objects with which it will work.
Unfortunately, the project is very large and there is no possibility to rewrite it, the task is to improve its architecture and interaction of the kernel with the services “services” with as little blood as possible.
I would like to know the opinion of experts on the issues:
- Is this a normal scheme in this case (separation of reading and writing)?
- which of the options to read prefer?
- if you still use the option of sending a packaged sql query and executing it with the kernel, which framework would you advise? I now drew attention to the JOOQ I do not know whether it is suitable for this or not?
Thanks in advance.