Skip to content

Conversation

@destyk
Copy link

@destyk destyk commented Sep 21, 2025

Summary

This PR introduces a new Prisma-based database driver for the
@nestixis/nestjs-inbox-outbox library, enabling Inbox/Outbox event
handling without creating additional database connections.

Features

  • Full lifecycle support: event creation, persistence, removal, flush, and retry.
  • TTL handling: supports readyToRetryAfter, expiresAtTTL, and maxExecutionTimeTTL.
  • JSON payload storage: complex event payloads and listener tracking.
  • Single PrismaClient usage: no extra database connections.
  • Easy NestJS integration via PrismaDatabaseDriverFactory.

Changes

  • Added PrismaDatabaseDriver implementing the DatabaseDriver interface.
  • Added PrismaDatabaseDriverFactory for NestJS async module integration.
  • Created Prisma schema InboxOutboxTransportEvent with BigInt timestamps.
  • Added full integration tests covering create, persist, flush, retry, and remove events.

Testing

  • Integration tests with in-memory SQLite verify complete driver lifecycle.
  • e2e tests ensure proper handling of TTLs, retry logic, and JSON payloads.

Migration / Usage

  1. Add InboxOutboxTransportEvent model to your Prisma schema.
  2. Use PrismaDatabaseDriverFactory in InboxOutboxModule.registerAsync
    as the driverFactory.
  3. No additional Prisma connections are required.

Notes

  • expireAt, insertedAt, and readyToRetryAfter use BigInt for millisecond timestamps.
  • delivedToListeners and eventPayload are stored as JSON for complex objects.

@destyk
Copy link
Author

destyk commented Sep 23, 2025

@axotion check this PR

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