System Architecture Overview
System Architecture Overview
The faizanGeek/ClaimProcessingSystem is a robust, event-driven application built on the Spring Boot framework, designed to streamline the management of insurance claims. It integrates several modern technologies to ensure scalability, responsiveness, and secure processing of claim submissions, status updates, and user notifications.
The system's architecture comprises the following key components, working in concert to deliver its functionality:
- Spring Boot Application: The primary backend service, exposing RESTful APIs.
- Persistent Database: For durable storage of all core application data.
- Redis: An in-memory data store for high-speed caching.
- Apache Kafka: A distributed streaming platform for asynchronous communication and event processing.
- Email Service: Facilitates transactional email notifications to users.
- Spring Security (OAuth2/JWT): Provides comprehensive authentication and authorization.
- Scheduled Batch Processing: Automates recurring background tasks.
Core Components and Their Interactions
The following diagram provides a high-level overview of how these components interact within the Claim Processing System:
1. Spring Boot Application (Core Service)
This is the central application that exposes RESTful APIs for managing claims, users, and reports. It acts as the primary interface for external clients and orchestrates interactions with other backend components.
- Responsibilities: Handles user authentication, claim lifecycle management (submission, update, retrieval, deletion), user profile management, and report generation.
- Interaction: Processes incoming HTTP requests, performs business logic, and communicates with the database, cache, and message broker.
2. Persistent Database
A relational database (managed via Spring Data JPA) serves as the system's durable storage for all critical application data.
- Stores: User accounts, detailed claim information (e.g., claim type, amount, status, history), and reporting metrics.
- Interaction: The Spring Boot application performs CRUD (Create, Read, Update, Delete) operations on this database for persistent data storage and retrieval.
3. Redis (Caching Layer)
Redis is integrated as an in-memory data store, specifically for caching frequently accessed data to enhance performance.
- Purpose: Primarily used to cache current claim statuses, allowing for rapid retrieval and reducing direct load on the persistent database for common read operations.
- Interaction: The
ClaimServicewithin the Spring Boot application interacts directly with Redis to store and retrieve claim status information.
4. Apache Kafka (Event Bus)
Kafka acts as a central asynchronous event streaming platform, enabling decoupled communication and event-driven workflows across the system.
claim-status-updatesTopic: TheClaimServicepublishes messages to this topic whenever a claim's status changes.user-notifications/unsubscribe-notificationsTopics: TheNotificationServicepublishes messages to these topics for managing user subscriptions and general notifications.- Kafka Consumers:
- A consumer (e.g., configured in
KafkaConsumerConfig) listens to relevant topics (likeclaim-updates, which processesClaimStatusUpdateMessageobjects) to react to events. - Upon receiving a claim status update message, this consumer triggers the
EmailServiceto send a notification to the affected user.
- A consumer (e.g., configured in
5. Email Service
The EmailService is responsible for sending out various transactional and informational email communications to users.
- Trigger: It is primarily invoked by Kafka consumers in response to specific events (e.g., a claim status change, subscription confirmations).
- Functionality: Sends automated emails to keep users informed about important updates and activities related to their claims or notifications.
6. Security (OAuth2 and JWT)
The system implements robust security mechanisms to protect sensitive data and control access to its resources.
- Authentication: Users authenticate with their credentials and receive a JSON Web Token (JWT).
- Authorization: This JWT is then included in subsequent API requests, allowing the system to verify the user's identity and determine their permissions for accessing specific resources.
- Implementation: Utilizes Spring Security, configured with OAuth2 and a custom
JwtAuthenticationFilter, to enforce stateless, token-based security across all protected endpoints.
7. Scheduled Batch Processing
Automated tasks run in the background at predefined intervals to perform routine operations.
ClaimBatchService: Contains a@Scheduledtask that executes periodically (e.g., hourly).- Functionality: This task automatically identifies and processes claims that require attention (e.g., claims pending for a prolonged period), updating their statuses and triggering corresponding notifications.
Key Interaction Summary
The Claim Processing System functions by having external clients interact with the Spring Boot Application via authenticated REST APIs. The application then leverages the Persistent Database for data storage, Redis for fast caching of dynamic data like claim statuses, and Apache Kafka for asynchronous communication of events such as claim status changes and user notifications. Kafka Consumers react to these events, often triggering the Email Service for user communication. All API interactions are secured through OAuth2/JWT, and a Scheduled Batch Processor handles recurring background tasks like processing pending claims. This modular and event-driven approach ensures a scalable and efficient claim management solution.