Skip to content

Conversation

aniebietafia
Copy link
Contributor

@aniebietafia aniebietafia commented Sep 10, 2025

Summary by CodeRabbit

  • New Features
    • Added a root API endpoint that returns a welcome message for quick health/availability checks.
  • Refactor
    • Switched verification emails to asynchronous queue processing, improving signup responsiveness and delivery reliability.
    • Updated OCR event handling to improve message processing stability and retry behavior.
  • Chores
    • Streamlined container runtime: standardized working directory, exposed port 8080, simplified startup command, and removed unused OCR dependencies for smaller images and faster startup.

Signed-off-by: aniebietafia <aniebietafia87@gmail.com>
Copy link

coderabbitai bot commented Sep 10, 2025

Walkthrough

Introduces a root “start” API controller, switches email verification to asynchronous RabbitMQ handling with a new queue consumer, updates event publishing to use convertAndSend with type/correlation headers, adjusts OCR listener to consume payload + correlationId, extends RabbitMQ class mapping for OCR events, and simplifies the runtime Docker image.

Changes

Cohort / File(s) Summary
Containerization updates
Dockerfile
Reorders build steps; sets /app as workdir. Removes OCR packages and related env vars; exposes 8080. Copies built JAR as UnravelDocs.jar and uses ENTRYPOINT with java -jar.
App start endpoint
src/main/java/com/extractor/unraveldocs/appstart/AppStartController.java
Adds root GET endpoint returning UnravelDocsDataResponse<String> with OpenAPI annotations.
Email async queue pipeline
src/main/java/com/extractor/unraveldocs/auth/components/UserRegisteredEventHandler.java, src/main/java/com/extractor/unraveldocs/events/EmailQueueConsumer.java, src/main/java/com/extractor/unraveldocs/messaging/emailtemplates/AuthEmailTemplateService.java
Handler now enqueues verification emails to RabbitMQ using prepared EmailMessage. Adds consumer listening to queue to send emails. Extracts prepareVerificationEmail(...) helper; sendVerificationEmail(...) now delegates.
Event publishing refactor
src/main/java/com/extractor/unraveldocs/events/EventPublisherService.java
Replaces manual Message construction with convertAndSend, setting __TypeId__ and correlationId via post-processor; old path commented.
RabbitMQ class mapping
src/main/java/com/extractor/unraveldocs/config/RabbitMQConfig.java
Maps "OcrRequested" to OcrRequestedEvent in DefaultClassMapper.
OCR listener update
src/main/java/com/extractor/unraveldocs/ocrprocessing/events/OcrMessageListener.java
Listener now receives OcrRequestedEvent payload and correlationId from headers; prior BaseEvent<> method commented out; logs and rethrows on failure.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant API as Application (Auth)
  participant Tmpl as AuthEmailTemplateService
  participant MQ as RabbitMQ Exchange/Queue
  participant Cons as EmailQueueConsumer
  participant Mail as EmailOrchestratorService

  User->>API: Register / triggers verification
  API->>Tmpl: prepareVerificationEmail(...)
  Tmpl-->>API: EmailMessage
  API->>MQ: publish EmailMessage
  note over MQ: Message enqueued for async processing
  Cons-->>MQ: @RabbitListener consume
  Cons->>Mail: sendEmail(EmailMessage)
  Mail-->>Cons: result
  Cons-->>MQ: ack or rethrow on failure
Loading
sequenceDiagram
  autonumber
  participant Pub as EventPublisherService
  participant MQ as RabbitMQ Exchange/Queue
  participant OCR as OcrMessageListener
  participant Svc as OcrService

  Pub->>MQ: convertAndSend(payload)\n(set __TypeId__, correlationId)
  MQ-->>OCR: deliver message
  OCR->>Svc: processOcrRequest(payload, correlationId)
  Svc-->>OCR: success/failure
  alt failure
    OCR-->>MQ: rethrow -> retry/DLQ
  else success
    OCR-->>MQ: ack
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my ears at queues that sing,
A welcome at “/” — a gentle spring.
Emails hop to burrows, then take flight,
OCR follows headers through the night.
Events now leap with labeled might—
Ship the jar, ignite the light,
UnravelDocs bounds just right. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between c570876 and fb23301.

📒 Files selected for processing (8)
  • Dockerfile (1 hunks)
  • src/main/java/com/extractor/unraveldocs/appstart/AppStartController.java (1 hunks)
  • src/main/java/com/extractor/unraveldocs/auth/components/UserRegisteredEventHandler.java (1 hunks)
  • src/main/java/com/extractor/unraveldocs/config/RabbitMQConfig.java (2 hunks)
  • src/main/java/com/extractor/unraveldocs/events/EmailQueueConsumer.java (1 hunks)
  • src/main/java/com/extractor/unraveldocs/events/EventPublisherService.java (2 hunks)
  • src/main/java/com/extractor/unraveldocs/messaging/emailtemplates/AuthEmailTemplateService.java (2 hunks)
  • src/main/java/com/extractor/unraveldocs/ocrprocessing/events/OcrMessageListener.java (4 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2024.2.5
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Copy link
Contributor

⚠️ CodeQL security scan failed. Please check the workflow logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant