I have 4 services as given below -
- Notes-service -- takes NotesRequest and produces NotesResponse
- Reminder-service -- takes ReminderRequest and produces ReminderResponse
- Todo-service -- takes TodoRequest and produces TodoResponse
- Personal-assistant service -- takes AssistantRequest and AssistantResponse
Personal-assistant service calls the 3 services internally, the Notes-service, Reminder-service and the Todo-service. Notes-service will contain these two request and response pojos inside it --
- NotesRequest.java
- NotesResponse.java
But to call this with the help of a Rest client, Personal-assistant will also require these pojos. A possible way could be to create a common module with the name of common-service and put the sharable request response objects for each service in common-service. Each of the service modules will have a dependency to common-service.
Is there any good approach to put the code clean and modular and make the deployments independent.