Class: CDC::Parallel::Router
- Inherits:
-
Object
- Object
- CDC::Parallel::Router
- Defined in:
- lib/cdc/parallel/router.rb
Overview
Routes supported CDC objects to the correct runtime pool.
Instance Method Summary collapse
-
#initialize(processor_pool:, transaction_pool:) ⇒ Router
constructor
A new instance of Router.
-
#process(item) ⇒ CDC::Core::ProcessorResult
Process a supported CDC work item.
Constructor Details
#initialize(processor_pool:, transaction_pool:) ⇒ Router
Returns a new instance of Router.
9 10 11 12 |
# File 'lib/cdc/parallel/router.rb', line 9 def initialize(processor_pool:, transaction_pool:) @processor_pool = processor_pool @transaction_pool = transaction_pool end |
Instance Method Details
#process(item) ⇒ CDC::Core::ProcessorResult
Process a supported CDC work item.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cdc/parallel/router.rb', line 18 def process(item) case item when CDC::Core::ChangeEvent @processor_pool.process(item) when CDC::Core::TransactionEnvelope @transaction_pool.process(item) else raise UnsupportedWorkItemError, "unsupported CDC work item: #{item.class}" end end |