This Spring Boot microservices application consists of the following services:
-
API Gateway: Acts as a single entry point for external and internal users.
-
Client Request Service: Handles external user requests to process a string of text.
-
Discovery Server: Manages service registration and discovery.
-
Sensitive Words Service: Allows internal users to perform CRUD operations on sensitive words. The application is load balanced to ensure high availability and reliability.
- Description: Acts as the gateway for all external and internal requests. Routes requests to the appropriate microservice.
- Technologies: Spring Cloud Gateway, Eureka Client
- Description: Accepts a string of text from external users and processes it.
- Endpoints: POST /bloop: Accepts a JSON payload containing a string of text to process.
- Technologies: Spring Boot, Eureka Client
- Description: Manages the service registry, allowing microservices to discover each other.
- Technologies: Spring Cloud Netflix Eureka Server
-
Description: Provides CRUD operations for managing sensitive words. Accessible to internal users.
-
Endpoints:
- GET /api/v2/sensitveWords/words: Retrieve all sensitive words.
- GET /api/v2/sensitveWords/word/search: Retrieve a sensitive word by searching the word.
- POST /api/v2/sensitveWords/words: Add sensitive words from the .txt file.
- POST /api/v2/sensitveWords/word: Add a new sensitive word.
- PUT /api/v2/sensitveWords/word/{id}: Update an existing sensitive word.
- DELETE /api/v2/sensitveWords/word/{id}: Delete a sensitive word by ID.
-
Technologies: Spring Boot, Spring Data JPA, Eureka Client
The application uses Spring Cloud LoadBalancer to distribute incoming requests across multiple instances of the client-request-service and sensitive-words-service to ensure high availability and scalability.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
- Java 11 or higher
- Maven
- Endpoint: POST /process
- Payload
{
"word": "sample text"
}
Internal users can manage sensitive words through the sensitive-words-service.
- Endpoints
- GET /api/v2/sensitveWords/words: Retrieve all sensitive words.
- GET /api/v2/sensitveWords/word/search: Retrieve a sensitive word by searching the word.
- POST /api/v2/sensitveWords/words: Add sensitive words from the .txt file.
- POST /api/v2/sensitveWords/word: Add a new sensitive word.
- PUT /api/v2/sensitveWords/word/{id}: Update an existing sensitive word.
- DELETE /api/v2/sensitveWords/word/{id}: Delete a sensitive word by ID.
application. Properties
Each service has its own application.properties file located in the src/main/resources directory. Customize these properties as needed.
Ensure that each service has the correct Eureka client configuration to register with the Discovery Server:
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
see application.properties
of API Gateway
This Spring Boot microservices application is designed to handle external user requests and internal CRUD operations efficiently, with high availability through load balancing and service discovery. Follow the steps provided to set up and run the application.