generated from BUMETCS673/GroupProjectTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add notificationservice-iter1 readme.md
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |