Skip to content

Conversation

@jeanc80
Copy link

@jeanc80 jeanc80 commented Jan 6, 2026

Summary

This pull request introduces idempotency handling and optimistic versioning for transactions to prevent duplicate processing and ensure data consistency.

Key changes

  • Added idempotency_key, request_hash, and version columns to transactions table
  • Created unique partial index for idempotency enforcement
  • Implemented automatic createdAt initialization with @PrePersist
  • Updated persistence layer to support idempotent operations
  • Rebuilt Docker environment and synchronized schema migrations

Technical details

  • Flyway/Liquibase migrations: V4, V5
  • Database: transactions table
  • Constraint: unique index on idempotency_key (when not null)

Testing

  • Environment rebuilt using docker compose
  • Idempotency validated via Postman by sending repeated requests with the same idempotency key
  • Verified that duplicated requests do not generate new records

Impact

  • Prevents duplicated financial transactions
  • Improves system resilience and API reliability
  • No breaking changes to public API

Checklist

  • Database migrations executed successfully
  • Docker environment rebuilt
  • Idempotency behavior tested
  • No breaking API changes

Author

Jean Carlos Flores León
Senior Software Engineer
GitHub: @jeanc80

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