Skip to content

313hemant313/TheGameNotification

Repository files navigation

TheGameNotification- A Spring boot standalone notification service.

License: MIT

alt text

TheGameNotification uses a number of projects to work properly:

  • Spring Boot - Open source Java-based framework
  • Maven Maven is a powerful project management tool that is based on POM (project object model)
  • Postgresql - The World's Most Advanced Open Source Relational Database.
  • Hibernate - More than an ORM
  • HikariCP - HikariCP is a "zero-overhead" production ready JDBC connection pool
  • Apache Kafka - Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.

Prerequisites

The following items should be installed in your system:

Supported channels

  • SMS
Using AWS Pinpoint api, to add any other vendor api just create a service and autowire in SmsNotificationService.class
  • WHATSAPP
Using Facebook whatsapp api, to add any other vendor api just create a service and autowire in WhatsappNotificationService.class
  • EMAIL
Using AWS Pinpoint api, to add any other vendor api just create a service and autowire in EmailNotificationService.class

Usage

Add dependency in pom.xml

<dependency>
  <groupId>tech.thegamedefault</groupId>
  <artifactId>the-game-notification</artifactId>
  <version>1.0.0</version>
</dependency>

Required configurations

  • POSTGRESQL_URL
  • POSTGRESQL_USERNAME
  • POSTGRESQL_PASSWORD
  • KAFKA_BOOTSTRAP_SERVERS
  • PINPOINT_ACCESS_KEY
  • PINPOINT_ACCESS_SECRET
  • PINPOINT_REGION
  • PINPOINT_PROJECT_ID
  • WHATSAPP_URL
  • WHATSAPP_PHONE_NUMBER_ID
  • WHATSAPP_ACCOUNT_ID
  • WHATSAPP_ACCESS_TOKEN

Class Diagram

alt text

Exposed Http Endpoints

Feature Route
Send any type of notification [ /notification/send ]

Kafka Consumer Payload for different type of channels

{
  "sms": {
    "appId": "TheGameDefault.TECH",
    "notificationType": "SMS",
    "message": "This is a test message from TheGameNotification service.",
    "destinations": [
      "+919XXXXXXXXX"
    ]
  },
  "whatsapp": {
    "appId": "TheGameDefault.TECH",
    "notificationType": "WHATSAPP",
    "message": "This is a test message from TheGameNotification service.",
    "destinations": [],
    "destination": "919XXXXXXXXX"
  },
  "email": {
    "appId": "TheGameDefault.TECH",
    "notificationType": "EMAIL",
    "subject": "Test email from notification service",
    "message": "This is a test message from TheGameNotification service.",
    "htmlBody": null,
    "destinations": [
      "+919XXXXXXXXX"
    ]
  }
}

To Run

./mvnw spring-boot:run

To Build

./mvnw clean install

To run via docker compose [Not tested]

docker compose up --build