The Events Notifier Service is a Python-based application designed to emit events via RabbitMQ. This service is developed to facilitate the communication of events between different components of a system, ensuring that events are reliably transmitted and received.
- Emit events to RabbitMQ
- Configurable event types and payloads
- Integration with Django for easy management
- Supports JWT authentication for secure access
- OpenAPI documentation with drf-spectacular
-
Clone the repository:
git clone https://github.com/BlueCJIOH/events-notifier.git cd events-notifier -
Build and run the services using Docker Compose:
cd config docker-compose up --build -d docker-compose exec web python manage.py migrate && python manage.py loaddata fixtures/users.json
cd another-service docker-compose up --build -d -
Request to urls:
curl -X POST http://localhost:8000/api/auth/sign-in/ \ -H "Content-Type: application/json" \ -d '{"email": "your_username", "password": "your_password"}'
successful response:
{ "access_token": "your_jwt_token", "refresh_token": "your_refresh_token" }curl -X POST http://localhost:8000/tasks/ \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your_jwt_token" \ -d '{ "title": "TEXT", "description": "TEST" }'
successful response:
{ "id": 110, "title": "TEXT", "description": "TEST", "status": "pending", "created_at": "2025-01-08T10:06:25.406216Z", "updated_at": "2025-01-08T10:06:25.406239Z", "user": 1 } -
Connect to websocket (make sure you have wscat installed)
wscat -c ws://localhost:8000/ws/tasks/
-
You have logs from notifier service in ClickHouse
docker exec -it clickhouse clickhouse-clientSELECT * FROM logs; -- to see the table logs
pip install pre-commit
pre-commit install
pre-commit run --all-files # if you wanna test manually
git commit -m "Your message" --no-veriyfy # without pre-commit checkTo emit an event, send a POST request to the appropriate endpoint with the event data. The service will handle the rest, ensuring the event is published to RabbitMQ and logged by ClickHouse.
API documentation is available at /api/docs/ and /api/redoc/ endpoints, providing detailed information about the available endpoints and their usage.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for more details.