From 04a15e98108ae123e81d634e3e0673c9462051b5 Mon Sep 17 00:00:00 2001 From: small_J <90347002+zjzy1002@users.noreply.github.com> Date: Tue, 28 May 2024 15:30:09 -0400 Subject: [PATCH] add notificationservice-iter1 readme.md --- notificationIter1README.md | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 notificationIter1README.md diff --git a/notificationIter1README.md b/notificationIter1README.md new file mode 100644 index 0000000..37deef2 --- /dev/null +++ b/notificationIter1README.md @@ -0,0 +1,60 @@ +# Notification Service + +This is a notification service built with Spring Boot and RabbitMQ. The service demonstrates the use of the Observer design pattern to send notifications via a RabbitMQ Fanout Exchange. + +## Prerequisites + +- Java 11 or higher +- RabbitMQ server +- Docker (optional, for running RabbitMQ) + +## Getting Started + +### Local running RabbitMQ(MacOS) +install RabbitMQ server with: +``` +brew install rabbitmq +``` +start a local RabbitMQ node: +``` +brew services start rabbitmq +``` +stop a running node: +``` +brew services stop rabbitmq +``` + +### Running RabbitMQ with Docker + +If you don't have RabbitMQ installed, you can run it using Docker: + +```bash +docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management +``` +Access the RabbitMQ management console at http://localhost:15672 with the default username and password (guest/guest) + +### Clone repository +``` +git clone https://github.com/yourusername/notification-service.git +cd notification-service +``` + +### Build & run the application +1.Build the application +``` +./gradlew build +``` +2.Run the application +``` +./gradlew bootRun +``` +### Testing +Use API client like Postman to send a POST request to /send-notification endpoint: + +URL: http://localhost:8081/send-notification +Method: POST +Body: +Key:"message" +Value:"Hello World" + +Check the logs of your Spring Boot application to see the received notifications \ No newline at end of file