Class: RubyEventStore::Outbox::Runner
- Inherits:
-
Object
- Object
- RubyEventStore::Outbox::Runner
- Defined in:
- lib/ruby_event_store/outbox/runner.rb
Instance Method Summary collapse
-
#initialize(consumer, configuration, logger:) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(consumer, configuration, logger:) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 10 11 12 13 14 |
# File 'lib/ruby_event_store/outbox/runner.rb', line 6 def initialize(consumer, configuration, logger:) @consumer = consumer @logger = logger @sleep_on_empty = configuration.sleep_on_empty @split_keys = configuration.split_keys @locking = configuration.locking @gracefully_shutting_down = false prepare_traps end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby_event_store/outbox/runner.rb', line 16 def run logger.info("Initiated RubyEventStore::Outbox v#{VERSION}") logger.info("Using #{@locking ? "locking" : "non-locking"} mode") logger.info("Handling split keys: #{split_keys ? split_keys.join(", ") : "(all of them)"}") while !@gracefully_shutting_down was_something_changed = consumer.process if !was_something_changed STDOUT.flush sleep sleep_on_empty end end logger.info "Gracefully shutting down" end |