eOffice - Collaboration through microservices using Redis
Tags: redishackathon, redis, microservices, pubsub
Published: 2022-08-29 20:00:31


### Table of contents
[Overview](#overview-of-my-submission)
[Submission Category](#submission-category)
[Video](#video)
[Link to the application](#link-to-the-application)
[Link to code](#link-to-code)
[Architecture](#architecture)
[How the data is stored](#how-the-data-is-stored)
[Functionalities](#functionalities)


## Overview of My Submission
**eOffice** is human resources platform that provides processes to onboard a new employee and to manage the benefits of the employees distributing the responsibilities between the different rolls.


### Submission Category
The submission category is **Microservices Mavens** using for communication between services the pubSub feature from Redis.

### Video
{% embed https://www.youtube.com/watch?v=ornpa9Fs8YU %}
## Architecture & Technologies

## Link to the application
The application is hosted in Azure. 
[Link to the application](https://eofficeapp.azurewebsites.net/)

## Link to Code
{% embed https://github.com/AlexandraFolvaiter/e-office %}

### Architecture

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ulp8ceye3qwd0hkxibc.png)

* Presentation project: Server Blazor Application using .Net 6.0
* Microservices: Web API using .Net 6.0
* Databases: SQL Server 
* Microservices communication: Redis pub/sub

### Language Used
C# - .Net 6.0

### Flow diagrams
1. Create the onboarding
![CreateOnboarding Flow](https://user-images.githubusercontent.com/17809789/187279055-87c56b43-0cde-4bdc-be9a-8d1d3d74ff3d.png)

3. Resolve a system account request
![resolve-sysytem-accounts-request-flow](https://user-images.githubusercontent.com/17809789/187279074-4f186016-9504-4c3d-9b8b-8172bbda0e76.png)

## How the data is stored

The microservices are communicating with each other using the pub/sub from Redis, for each type of communication a different channel will be used.
3 channels
* SystemAccount_Channel 
    * Publisher: Onboardings Module
    * Subscriber:  SystemAccounts Module
* Leave_Channel
    * Publisher: Onboardings Module
    * Subscriber: LeaveBalance Module
* Onboarding_Channel
    * Publisher: SystemAccounts Module, LeaveBalance Module
    * Subscriber: Onboardings Module

Publis code

```
var modelAsString = JsonConvert.SerializeObject(model);
_pubSub.Publish("channel_name", modelAsString);
```

Subscribe code

```
connection.GetSubscriber()
    .Subscribe("channel_name", (channel, message) =>
    {
        // DO something
    });
```


## Functionalities

* Dashboard

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/arj3dx4xw6ixqk3ewpee.png)


* See all onboardings

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pti6o4mt2382wdl8pwqt.png)


* Create an onboarding

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13stmfs1g1tvdlf3fu0e.png)


* See details of an onboarding

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3djxv8nacqwnzxylf0og.png)


* See all system accounts requests

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mp5v8uv9okm8od4vcop6.png)


* Resolve a system account request

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/77q54sh8b67n6umjr2yo.png)


- - - 

* _Check out [Redis OM](https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries), client libraries for working with Redis as a multi-model database._
* _Use [RedisInsight](https://redis.info/redisinsight) to visualize your data in Redis._
* _Sign up for a [free Redis database](https://redis.info/try-free-dev-to)._