Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 2.71 KB

README.md

File metadata and controls

60 lines (41 loc) · 2.71 KB

Akka Microservices

The aim of this project is to show how a microservices architecture can be laid out using the Akka stack as its foundation.

Warning:

This is a Work In Progress example. So far, the structure for a single microservice has been laid out together with a set of CRUD endpoints for an example entity. Interaction between two microservices will be added next.

Microservices platform structure

The repository consists of the following individual projects:

user-service

It contains all concrete code related to the User bounding context. That is all of the User domain operations as well as all of the necessary interfaces to interact with it.

Both common and testkit are dependencies of this project.

common

It contains all common abstractions which are not specific to any subdomain in particular. Those are for instance base and marker traits for domain objects and components such as Entities, Services and Repositories. It also houses any common and technical facilities which are wanted to be available across different subdomains.

This project should be autonomous and not depend on any other. No subdomain specific code should be included here.

testkit

It contains all common abstractations used for writing Unit and Integration specifications accross different microservices.

This project should depend only on common.

Hexagonal Architecture

An Hexagonal Architecture has been chosen to structure each microservice project. The Hexagonal Architecture reinforces the separation of business logic from technical concerns which is a key aspect in a microservices environment where different communication technologies and protocols may take place (such as REST, GraphQL, gRPC, messaging queues, etc).

The Hexagonal Architecture defines mainly two distinct layers: the inside and the outside. The former holds all of the domain objects and components while the latter houses all of the technical components which facilitate access from and to the inner layer. Those are named domain and infrastructure respectively in this project:

microservice
├── domain
│   ├── model
│   └── services
├── infrastrucuture
│   ├── rest
│   ├── grpc
│   ├── messaging
│   └── persistence
└── Main

Running locally

All microservices can be run individually in a local machine using sbt commands. In order to do so, common and testkit projects should be first published locally using below commands:

cd common/ | sbt publishLocal
cd testkit/ | sbt publishLocal