Class: Journaled::DeliveryAdapter
- Inherits:
-
Object
- Object
- Journaled::DeliveryAdapter
- Defined in:
- lib/journaled/delivery_adapter.rb
Overview
Base class for delivery adapters
Journaled ships with two delivery adapters:
- Journaled::DeliveryAdapters::ActiveJobAdapter (default) - delivers via ActiveJob
- Journaled::Outbox::Adapter - delivers via Outbox-style workers
Direct Known Subclasses
Journaled::DeliveryAdapters::ActiveJobAdapter, Outbox::Adapter
Class Method Summary collapse
-
.deliver(events:, enqueue_opts:) ⇒ void
Delivers a batch of events.
-
.transaction_connection ⇒ ActiveRecord::ConnectionAdapters::AbstractAdapter
Returns the database connection to use for transactional batching.
-
.validate_configuration! ⇒ void
Validates that the adapter is properly configured.
Class Method Details
.deliver(events:, enqueue_opts:) ⇒ void
This method returns an undefined value.
Delivers a batch of events
16 17 18 |
# File 'lib/journaled/delivery_adapter.rb', line 16 def self.deliver(events:, enqueue_opts:) # rubocop:disable Lint/UnusedMethodArgument raise NoMethodError, "#{name} must implement .deliver(events:, enqueue_opts:)" end |
.transaction_connection ⇒ ActiveRecord::ConnectionAdapters::AbstractAdapter
Returns the database connection to use for transactional batching
This allows delivery adapters to specify which database connection should be used when staging events during a transaction. This is only needed if you want to support transactional batching with your adapter.
27 28 29 |
# File 'lib/journaled/delivery_adapter.rb', line 27 def self.transaction_connection raise NoMethodError, "#{name} must implement .transaction_connection" end |
.validate_configuration! ⇒ void
This method returns an undefined value.
Validates that the adapter is properly configured
Called during Rails initialization in production mode. Raise an error if the adapter is not configured correctly (e.g., missing required dependencies, invalid configuration).
37 38 39 |
# File 'lib/journaled/delivery_adapter.rb', line 37 def self.validate_configuration! # Default: no validation required end |