Sha256: d23632f6375ab527e9367d457061138a0c5aea561b05d18c1871d546b40ef554
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module EventSourcery module Postgres module Projector def self.included(base) base.include(EventProcessing::EventStreamProcessor) base.prepend(TableOwner) base.include(InstanceMethods) base.class_eval do alias project process class << self alias project process alias projects_events processes_events alias projector_name processor_name end end end module InstanceMethods def initialize(tracker: EventSourcery::Postgres.config.event_tracker, db_connection: EventSourcery::Postgres.config.projections_database) @tracker = tracker @db_connection = db_connection end private def process_events(events, subscription_master) events.each do |event| subscription_master.shutdown_if_requested db_connection.transaction do process(event) tracker.processed_event(processor_name, event.id) end EventSourcery.logger.debug { "[#{processor_name}] Processed event: #{event.inspect}" } EventSourcery.logger.info { "[#{processor_name}] Processed up to event id: #{events.last.id}" } end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
event_sourcery-postgres-0.3.0 | lib/event_sourcery/postgres/projector.rb |