Skip to content

rnhc1000/notifications-be

Repository files navigation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  **## Take-home Microservices Challenge

This is how we faced the challenge of creating some microservices to consume notifications services.**

Table of contents

Overview

This notification app has been coded using Spring Boot, Spring JPA, Spring AWS SDK, Spring RabbitMQ,MapStruct, Jackson, Lombok, OpenAPI, H2 DB.

  • src
    • main
    • java
      • com/xxx/challenge/notification
        • config
        • controller
        • dto
        • entity
          • enums
        • mapper
        • payload
        • repository
        • services
          • exceptions
    • resources
      • db.migration
    • test

Requirements

- rabbitMQ running at 127.0.0.1:5672 socket
- H2 database classpath:data/notification
- profile active: dev
- service socket: 127.0.0.1:8095

Screenshot

Links

Built with

My Skills

How I did it

package com.gila.challenge.notification.entity.enums;

public enum MessageStatus {

  DELIVERED_SMS(1),
  DELIVERED_EMAIL(2),
  READY_TO_DELIVER(3),
  WAITING_EXCHANGE(4);

  private final int codeStatus;

  private MessageStatus(int codeStatus) {
    this.codeStatus = codeStatus;
  }

  public int getCodeStatus() {
    return codeStatus;
  }

  public static MessageStatus valueOf(int codeStatus) {
    for (MessageStatus value : MessageStatus.values()) {
      if (value.getCodeStatus() == codeStatus) {
        return value;
      }
    }

    throw new IllegalArgumentException("Invalid MessageStatus code");
  }
}

Continued development

  • Unit Tests
  • Provide a Json to FrontEnd including
    • delivery status of each message to frontend
    • count of messages consumed by subscriber
  • Subscriber Authentication
    • Spring JWT-OAuth2
  • Messages Pagination

Useful resources

Author