Skip to content

Commit

Permalink
add notificationservice-iter1 readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zjzy1002 authored May 28, 2024
1 parent 0a0299d commit 04a15e9
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions notificationIter1README.md
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

0 comments on commit 04a15e9

Please sign in to comment.