Environment Setup
Environment Setup
This section outlines the essential steps and infrastructure components required to set up and run the faizanGeek/ClaimProcessingSystem application. The system relies on several external services for data persistence, messaging, caching, and notifications.
Prerequisites
Before deploying the Claim Processing System, ensure you have the following installed:
- Java Development Kit (JDK) 17 or higher: The application is built with Spring Boot, which requires a compatible JDK.
- Apache Maven (3.6.0 or higher) or Gradle: For building the project.
- Docker and Docker Compose: Highly recommended for easily setting up required external services (Database, Kafka, Redis).
Core Services Setup
The Claim Processing System requires a relational database, Apache Kafka, Redis, and an SMTP server to function correctly.
1. Relational Database (e.g., PostgreSQL)
The application uses a relational database for storing claim, user, and report data. While any JPA-compatible database can be used, PostgreSQL is a common and robust choice.
Setup Steps (PostgreSQL with Docker):
- Start a PostgreSQL container:
docker run --name claim-db -e POSTGRES_DB=claimdb -e POSTGRES_USER=claimuser -e POSTGRES_PASSWORD=claimpassword -p 5432:5432 -d postgres:13 - Configure
application.properties: Update yoursrc/main/resources/application.properties(orapplication.yml) with the database connection details:spring.datasource.url=jdbc:postgresql://localhost:5432/claimdb spring.datasource.username=claimuser spring.datasource.password=claimpassword spring.jpa.hibernate.ddl-auto=update # Use 'create' or 'create-drop' for fresh setups, 'update' for existing schema spring.jpa.show-sql=true
2. Apache Kafka
Kafka is used for asynchronous claim status updates and user notifications. The application acts as both a producer and consumer.
Setup Steps (Kafka with Docker Compose):
-
Create a
docker-compose.ymlfile (if you don't have one):version: '3.8' services: zookeeper: image: 'bitnami/zookeeper:latest' ports: - '2181:2181' environment: - ALLOW_ANONYMOUS_LOGIN=yes kafka: image: 'bitnami/kafka:latest' ports: - '9092:9092' environment: - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181 - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 - ALLOW_PLAINTEXT_LISTENER=yes depends_on: - zookeeper -
Start Kafka and Zookeeper:
docker-compose up -dThis will make Kafka available at
localhost:9092. -
Kafka Topics: The application expects the following topics to exist. You might need to create them manually or configure Kafka to auto-create topics.
claim-status-updates(for internal claim status changes)claim-updates(consumed by the EmailService for notifications)user-notifications(for general user notifications)unsubscribe-notifications(for managing notification preferences)
-
Configure
application.properties: Ensure your Kafka bootstrap servers are correctly configured:spring.kafka.bootstrap-servers=localhost:9092 spring.kafka.consumer.group-id=group_id
3. Redis
Redis is utilized for caching claim statuses, providing quick retrieval.
Setup Steps (Redis with Docker):
- Start a Redis container:
docker run --name claim-redis -p 6379:6379 -d redis:latest - Configure
application.properties: Add the Redis connection details:spring.redis.host=localhost spring.redis.port=6379 # spring.redis.password=your_redis_password # Uncomment if Redis requires authentication
4. SMTP Server
The system sends email notifications for claim status updates. An SMTP server is required for this functionality.
Setup Steps (Example with Mailtrap or local SMTP server):
- Obtain SMTP credentials: If using a service like Mailtrap, get your host, port, username, and password. For a local setup, configure an SMTP server.
- Configure
application.properties:spring.mail.host=smtp.example.com spring.mail.port=587 spring.mail.username=your_smtp_username spring.mail.password=your_smtp_password spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true
Building and Running the Application
Once all external services are set up and application.properties is configured, you can build and run the Claim Processing System.
-
Build the project (using Maven): Navigate to the project root directory and run:
mvn clean installThis command compiles the code, runs tests, and packages the application into a JAR file.
-
Run the application:
java -jar target/claim-processing-system-0.0.1-SNAPSHOT.jar # Adjust JAR name if differentThe application will start, connect to the configured services, and be accessible, typically on
http://localhost:8080.
Your faizanGeek/ClaimProcessingSystem environment should now be fully operational.