Table of Contents
The goal of this project is to demonstrate code examples and approaches to software development. The project is a simple article service that allows users to view, create, and edit articles and comments through REST requests. It also demonstrates working with a message broker (RabbitMQ), such as sending messages about new articles and comments, as well as receiving messages about user deletions.
- Build:
mvn clean package
- Then, run
docker compose up
and Compose will start and run entire app.
If additional configuration is required, it can be done using environment variables:
-
SERVER_ADDRESS
- App service addressexample: 127.0.0.1
default: 0.0.0.0
-
SERVER_PORT
- App service portexample: 1234
default: 8090
-
DB_URL
- JDBC connection urlexample: jdbc:postgresql://{host}:{port}/{db_name}
-
RABBITMQ_HOST
- rabbitmq host address -
RABBITMQ_PORT
- rabbitmq port -
RABBITMQ_USERNAME
- rabbitmq user -
RABBITMQ_PASSWORD
- rabbitmq password -
RABBITMQ_VHOST
- rabbitmq virtual hostdefault: main
-
ACCESS_TOKEN_HEADER
- Authorization token header for REST requestsexample: Authorization
default: X-Access-Token
-
INCLUDE_TRACE
- Include stack traces to 5XX responsesexample: false
default: true
swagger-ui: http://127.0.0.1:8090/
- The service produces messages in the following format:
{
"messageId": "e730b04d-dbd6-403e-9021-de3dea75a993",
"articleId": 3,
"title": "New Article",
"createdAt": "2024-07-09T20:00:00Z"
}
queue: articles
{
"messageId": "e730b04d-dbd6-403e-9021-de3dea75a993",
"authorId": "e730b04d-dbd6-403e-9021-de3dea75a993",
"text": "New comment",
"createdAt": "2024-07-09T20:00:00Z"
}
queue: comments
- The service consumes messages in the following format:
{
"userId": "e730b04d-dbd6-403e-9021-de3dea75a993"
}
queue: deactivated-users
There are 3 functional roles:
- ROLE_ADMIN - crate and edit articles
- ROLE_USER - crate and edit comments
- anonymous - can only view content
This code is private and proprietary. It cannot be copied, modified, distributed, or used under any circumstances without explicit permission from the owner. Unauthorized use of this code is strictly prohibited.