https://github.com/hyuseinleshov/contact-service
A separate REST service used in the PowerLog application to save new contacts and fetch them by date.
https://github.com/hyuseinleshov/contact-service
contact-service gradle java lombok mysql rest-api rest-template scheduled-jobs scheduled-tasks spring-boot spring-boot-starter spring-data-jpa spring-web validation
Last synced: 4 days ago
JSON representation
A separate REST service used in the PowerLog application to save new contacts and fetch them by date.
- Host: GitHub
- URL: https://github.com/hyuseinleshov/contact-service
- Owner: hyuseinleshov
- License: mit
- Created: 2024-07-26T21:28:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-07T20:51:44.000Z (about 1 year ago)
- Last Synced: 2025-10-14T14:16:21.428Z (4 days ago)
- Topics: contact-service, gradle, java, lombok, mysql, rest-api, rest-template, scheduled-jobs, scheduled-tasks, spring-boot, spring-boot-starter, spring-data-jpa, spring-web, validation
- Language: Java
- Homepage:
- Size: 94.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ContactService
ContactService is a reactive RESTful service designed to handle the creation and retrieval of contact messages. This service is used in conjunction with the PowerLog application to manage user contacts efficiently.
## Features
- Save new contacts
- Fetch all contacts
- Fetch contacts created after a specified date and time
- Produce contact messages to Apache Kafka for real-time processing## Technologies Used
- Spring Boot
- Spring Reactive
- R2DBC
- MySQL
- Flyway for data migration tool
- Spring Security
- Gradle for build automation
- Apache Kafka
- OpenAPI
- Lombok## Getting Started
### Prerequisites
- Java 17 or higher
- Gradle
- MySQL (or any other SQL database)
- Apache Kafka### Installation
1. Clone the repository:
```sh
git clone https://github.com/hyuseinlesho/contact-service.git
```2. Set environment variables for your database username and password:
```sh
DB_USERNAME=your_username
DB_PASSWORD=your_password
```3. Create contact_service database
```sql
create schema contact_service;
```5. Install and run Apache Kafka server.
6. Run the application.
### API Documentation
This project uses springdoc-openapi to generate API documentation.
You can access the Swagger UI to explore and interact with the API by running the application and navigating to the following URL in your web browser:
```
http://localhost:8081/swagger-ui.html
```### Apache Kafka
- **Kafka Server Requirement:**
- Ensure Apache Kafka is installed and running to test it locally.- Produces messages to the Kafka topic `contact-topic` when a new contact is created.
- Configured bootstrap servers, key and value serializers in `application.yaml` file.### Reactive Service
- **Reactive Programming**: Utilizes Spring Reactive to handle asynchronous data streams.
- **Controller and Service**: Manages contact creation and retrieval using reactive endpoints.
- **R2DBC**: Reactive relational database connectivity.
- **Non-Blocking**: All operations are non-blocking, providing better scalability and performance.### Flyway for Data Migration
- **Database Migrations**: Uses Flyway to handle database schema migrations.
- **Initial Migration**: Schema defined in `resources/db/migration/V1__init.sql`:
This setup allows the ContactService to handle real-time notifications and efficient management of user contacts.