_# Notifapp
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
The application verifies the customer’s preferences and send the notification to his or her preferred channel.
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.
The application sends the notification to the customer’s email or mobile phone. http://localhost:8083/api/notifications/send
- 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>
- to test it http://localhost:8081/swagger-ui/
All the configuration classes should be placed in this package.
All the controller classes that contain the exposed API should be placed in this package.
All the Java POJOs for the service should be placed in this package.
All the database entity objects should be placed in this package with the correct annotations used, such as @Entity, @Table, @Id, and @OneToMany.
All the request/response translations to the target service methods should be placed in this package.
All the JPA repositories should be placed in this package.
All the services supporting the controller classes should be placed in this package.
All the integrations with the destination services or database should be placed in this package.
-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"
}
- 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"
}
- request: post to url http://localhost:8083/api/notifications/send
- 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"
}
- request: post to url http://localhost:8080/api/notifications
- 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
}
https://devops.datenkollektiv.de/banner.txt/index.html
- run docker postgres, pgadmin, ... services --> docker-compose up -d
--> docker-compose --version docker-compose version 1.26.2, build eefe0d31
--> docker --version Docker version 19.03.12, build 48a66213fe
- Docker hub: registry to pull images.
-
Access pgAdmin http://localhost:5050/browser
-
connect to postgres database
-
dependencies
<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 11