I'm sorry for my english. There was a large java project(spring, hibernatne and etc) having the monolite architecture. Let's name it a core. Adding a new features was hard work so it was accepted a decision to make new features out of the core and then link them over http(REST api). Now there are the core and many "services" around it, but the core and services have one DB. Services don't transmit any data to each other. They work as a demon or the core makes request to them. When the core calls any of services, the following happens: a service gets request, makes directly sql query to the DB, executes own logic over received data and returns result to the core. I think it's a bad practice to use the common DB so i'd like to close directfull access for any of service to DB.
I have 2 idea how i can do that:
- for modification, i'd like to use events(Create, Update, Delete) and a boker(ActiveMQ, RabbitMQ)
for reading, i have one of 3 options:
2.1. to make internal API for each select query on the core side(it isn't a good option because we don't want to recompile the core that often)
2.2. to let services directly read data from DB
2.3. to pack sql query into some object on the "service" side and send it to the core, over there query will be unpacked and executed and result will be sent as a array of JSON back to client. Also on the core side i will check that it's only "select" query.
I'd like to ask you some question:
- is it a good option to separate reading and modification like this?
- which of options for reading could you recommend me?
- if i choose 2.3 option for reading, what a framework could you recommend me? i have started to look at JOOQ, but it may not fit for that at all
thanks