https://github.com/attaradev/jetstream_bridge
Production-ready NATS JetStream bridge for Ruby/Rails with outbox, inbox, DLQ, and overlap-safe stream provisioning.
https://github.com/attaradev/jetstream_bridge
dlq event-driven eventbus jetstream nats nats-streaming natsio ruby ruby-gem ruby-on-rails rubygem
Last synced: 4 months ago
JSON representation
Production-ready NATS JetStream bridge for Ruby/Rails with outbox, inbox, DLQ, and overlap-safe stream provisioning.
- Host: GitHub
- URL: https://github.com/attaradev/jetstream_bridge
- Owner: attaradev
- License: mit
- Created: 2025-08-13T23:35:21.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2026-01-30T00:48:22.000Z (4 months ago)
- Last Synced: 2026-01-30T07:49:45.415Z (4 months ago)
- Topics: dlq, event-driven, eventbus, jetstream, nats, nats-streaming, natsio, ruby, ruby-gem, ruby-on-rails, rubygem
- Language: Ruby
- Homepage:
- Size: 754 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Production-ready NATS JetStream bridge for Ruby/Rails with outbox, inbox, DLQ, and overlap-safe stream provisioning.
## Highlights
- Transactional outbox and idempotent inbox (optional) for exactly-once pipelines.
- Durable pull (default) or push consumers with retries, backoff, and DLQ routing.
- Auto stream provisioning with overlap protection; consumers auto-created on subscription.
- Rails-native: generators, migrations, health check, and eager-loading safety.
- Least-privilege friendly: run with `auto_provision=false` (stream must exist; consumers are auto-created).
- Mock NATS for fast, no-infra testing.
## Quick Start
```ruby
# Gemfile
gem "jetstream_bridge", "~> 7.1"
```
```bash
bundle install
bin/rails g jetstream_bridge:install
bin/rails db:migrate
```
The install generator creates the initializer, migrations, and optional health check scaffold. For full configuration options and non-Rails boot flows, see [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md).
Publish:
```ruby
JetstreamBridge.publish(event_type: "user.created", resource_type: "user", payload: { id: 1 })
```
Consume:
```ruby
consumer = JetstreamBridge::Consumer.new do |event|
User.upsert({ id: event.payload["id"] })
end
consumer.run!
```
## Documentation
- [Getting Started](docs/GETTING_STARTED.md) - Setup, configuration, and basic usage
- [API Reference](docs/API.md) - Complete API documentation for all public methods
- [Architecture & Topology](docs/ARCHITECTURE.md) - Internal architecture, message flow, and patterns
- [Production Guide](docs/PRODUCTION.md) - Production deployment and monitoring
- [Restricted Permissions & Provisioning](docs/RESTRICTED_PERMISSIONS.md) - Manual provisioning and security
- [Testing with Mock NATS](docs/TESTING.md) - Fast, no-infra testing
- [Reference Examples (Rails 7)](examples/README.md) - Non-restrictive and restrictive Dockerized examples with E2E tests
## License
MIT