Skip to content

bahareh-javidan/code-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Message Processing Application

Overview

The Message Processing Application is a Spring Boot–based service responsible for sending messages, tracking their delivery status, and maintaining a message history.
It is designed to be concurrent-safe, idempotent, and resilient under high load.


Features

  • Message creation and sending
  • Asynchronous message processing worker
  • Message history persistence
  • Opt-out support by phone number
  • OpenAPI / Swagger UI support

Technology Stack

  • Java 21
  • SpringBoot
  • Hibernate
  • Spring Validation
  • Springdoc OpenAPI
  • H2 (in-memory db)

Core Components

  • MessageController and OptOutController
    • REST APIs for sending messages and opt-out
  • MessageService
    • Orchestrates message creation and processing
  • MessageWorker
    • Handles concurrent message delivery
  • MessageHistoryService
    • Persists message history entries
  • GatewayRegistry
    • Routes messages to delivery gateways

Message Processing Flow

  • Client sends a message via API
  • Message is persisted with status PENDING
  • Worker picks up the message
  • Status transitions:
    • PENDING → SENT → DELIVERED / BLOCKED / FAILED
  • Message history is stored
  • Optimistic locking ensures only one worker processes a message

API Documentation

Swagger UI is available at: http://localhost:8080/swagger-ui/index.html

Running the Application

Prerequisites:

  • Java 21
  • Maven

Run locally

mvn clean spring-boot:run

Testing

Run tests:

mvn test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages