Keeping with the spirit of a microservice architecture, I'm pondering using a git repository for each service of my Scala+Akka based system. The build for each service produces an artifact that is published to a packaging system (e.g. maven) repo. These artifacts are the mechanism used for sharing common code.
Now, since using case classes for message passing between services, the same class version needs to be available everywhere. Would it be advantageous to separate each service in an interface and implementation artifacts using a multi-project build, and then only import the interface artifact from the dependent projects? Some alternatives would be to include both the interface and implementation on the same artifact and importing that, or have separate repos for the interface and implementation which seems overkill and likely to be too much overhead.
Here's where you will get the 2 view points on micro-service based designs, share everything and share nothing. I'm on the share nothing side. Agree to a communication interface (like JSON or some other serialization mechanism) and allow each service to handle the domain object representations separately. Here's why
If one updates its code base, another is free to not update until it absolutely has to update in order to interface properly. It also means that your parsing libs can interpret the objects as needed and ignore fields that they don't care about.
Logic tends to find its ways into things. Worse, business logic tends to find it's ways into little "helper" methods on classes, even case classes. This can adversely couple services in benign ways ...right up until it's no longer benign.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With