Skip to content

rnhc1000/notifications-be

Repository files navigation

                                                                                                                                     **## Microservices Challenge

This is how we faced the challenge of creating an application that allows the sending of a message through an Angular-based front-end app, providing an email and a phone number. The message is published to a RabbitMQ exchange that fuels the email queue, SMS queue and a message queue with the goal of how to build such application using Spring Boot, AWS Java SDK, Gmail and explore how the AMPQ protocol fits these requirements.

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 container running at 127.0.0.1:5672
- 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.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

Releases

No releases published

Packages

No packages published

Languages