I will explain my question with a simple example.
We have 10 'hexagonal' microservices which work with the same database storage for auditing. This database has a schema that looks like a tree of objects used by the services similarly.
So, logically, we describe this tree as a class 'org.example.service1.domain.AuditRecord' in each service.
And create an interface(port) that takes this AuditRecord:
package org.example.service1.port.AuditRepository;
save(org.example.service1.domain.AuditRecord record);
All other services have the same logic. So, there will be:
package org.example.service[2-10].port.AuditRepository;
save(org.example.service[2-10].domain.AuditRecord record);
They all have their own AuditRecord and port interface. But how to create an adapter as a separate artifact that will implement all these ports, thinking that the interface should be stored inside the application core to remove duplication?
Should we declare as adapter dependencies all services and describe them in this interface? But this will require putting all code of each service into another one...
Thanks for your help!