Azure Service Fabric Application Design

37 views Asked by At

I have a couple of stateful services in my Azure Service Fabric application. Both of them are related to each other, something like Employees & Departments through a common Key.

Employee has a departmentId to identify which department they belong to. Department has employeeId to identify what all employees belong to that department.

In the GetDeparmentEmployees API call (from Stateless service), I need to provide the information about the department (e.g. Function areas, who is leading the department) and employees (e.g. Employee Name, their role in the department).

Both the objects Employee and Department are stored in 2 separate reliable collections.

My question is about design best practices.

  1. I have an Employee contract in the employee service and currently stored in its own reliable collection.
  2. I have an Department contract in the department service and currently stored in its own reliable collection.

Do I have to create a seperate Employee contract in the department service, get the data from Employee reliable collection for that department and map it to the newly created Employee contract?

Or should can I create a common Employee contract and use it across both the services?

Although, the 2nd one seems to go against the principles of microservices (no shared libraries), first one seems like a lot of redundant work. (e.g. I may want to pull the personal information about the Employee in the future)

0

There are 0 answers