Giter Club home page Giter Club logo

notifapp's Introduction

_# Notifapp

Project Structure

Application Notification:

The application triggers the notification services to initiate the notification flow, and the services orchestrate the flow of notification messages. http://localhost:8080/api/notifications

Notification Preferences:

The application verifies the customer’s preferences and send the notification to his or her preferred channel.

Notification Template:

The application formats the notification to create a unique, tailor-made message to the customer, such as a notification about a change of mobile number or address.

Notification Gateway:

The application sends the notification to the customer’s email or mobile phone. http://localhost:8083/api/notifications/send

Add and Test the swagger with spring boot

  • configure swagger: add @EnableSwagger2 annotation on the configuration class along with the Docket bean.
  @Bean
  public Docket swagger() {
     return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            .paths(PathSelectors.any())
            .build();
  }
  • for spring boot version:
            <parent>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-parent</artifactId>
               <version>2.5.7</version>
               <relativePath/> <!-- lookup parent from repository -->
            </parent>
  • add:
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
       </dependency>

Project packages

config:

All the configuration classes should be placed in this package.

controllers:

All the controller classes that contain the exposed API should be placed in this package.

model:

All the Java POJOs for the service should be placed in this package.

entities:

All the database entity objects should be placed in this package with the correct annotations used, such as @Entity, @Table, @Id, and @OneToMany.

formatters:

All the request/response translations to the target service methods should be placed in this package.

repositories:

All the JPA repositories should be placed in this package.

services:

All the services supporting the controller classes should be placed in this package.

integration:

All the integrations with the destination services or database should be placed in this package.

Test Using Postman

Test Preferences:

-Post to http://localhost:8081/notification/preferences

    - Request: { "customerId": "123" }

    - Response: {
                        "customerId": "123",
                        "status": "SUCCESS",
                        "statusDescription": "Notification Received Successfully",
                        "smsPreferenceFlag": false,
                        "emailPreferenceFlag": true,
                        "emailAddress": "[email protected]",
                        "phoneNumber": "+6588232374"
                    }

Test Template:

  - Post Body:
                    {
                        "notificationParameters": [
                            {
                                "notificationParameterName": "name",
                                "notificationParameterValue": "Vamshi"
                            },
                            {
                                "notificationParameterName": "oldPhoneNumber",
                                "notificationParameterValue": "12345"
                            },
                            {
                                "notificationParameterName": "newPhoneNumber",
                                "notificationParameterValue": "09828723"
                            }
                        ],
                        "notificationTemplateName": "PhoneNumberChanged",
                        "notificationMode": "EMAIL"
                    }
  - Response:
                      {
                          "status": "SUCCESS",
                          "statusDescription": "Successfully merged the template with the template parameters",
                          "emailContent": "",
                          "smsContent": null,
                          "emailSubject": "Message from Citizen Bank"
                      }

Test Notification Gateway:

- request body: {
                  "customerId": "123",
                  "notificationMode": "EMAIL",
                  "notificationContent": "Hello Vamshi\n Welcome to the Citizen Bank\nYour balance is $ 47464646.50\nThanks",
                  "emailSubject": "ViewBalance",
                  "emailAddress":"[email protected]",
                  "phoneNumber":"+6588232374"
                }
- request response: {
                        "status": "SUCCESS",
                        "statusDescription": "Send Sucessfully"
                    }

Test Notification:

- request body: {
                  "customerId": "123",
                  "notificationMode": "",
                  "notificationParameters": [
                {
                    "notificationParameterName":"name",
                    "notificationParameterValue":"Spandana"
                },
                {
                    "notificationParameterName":"accountnumber",
                    "notificationParameterValue":"XXXX12323245666"
                },  
                {
                    "notificationParameterName":"balance",
                    "notificationParameterValue":"$ 47464646.50"
                }
                
                  ],
                  "notificationTemplateName": "ViewBalance"
                }
                
- request response: {
                        "status": "SUCCESS",
                        "statusDescription": "Notification Received Successfully",
                        "notificationReferenceId": 1
                    }

generate Banner for each microservice

https://devops.datenkollektiv.de/banner.txt/index.html

docker-compose.yml file

  • run docker postgres, pgadmin, ... services --> docker-compose up -d

docker version

--> docker-compose --version docker-compose version 1.26.2, build eefe0d31

--> docker --version Docker version 19.03.12, build 48a66213fe

docker hub

  • Docker hub: registry to pull images.

postgres

 <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
 </dependency>
 <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <scope>runtime</scope>
 </dependency>

java version

  • Java 11

notifapp's People

Contributors

mimi00000000 avatar

Stargazers

Hamza avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.