diff --git a/RAILS-DISCO_VERSION b/RAILS-DISCO_VERSION index 44bb5d1..f7abe27 100644 --- a/RAILS-DISCO_VERSION +++ b/RAILS-DISCO_VERSION @@ -1 +1 @@ -0.4.1 \ No newline at end of file +0.4.2 \ No newline at end of file diff --git a/active_domain/lib/active_domain/version.rb b/active_domain/lib/active_domain/version.rb index caa7591..d7a6eb3 100644 --- a/active_domain/lib/active_domain/version.rb +++ b/active_domain/lib/active_domain/version.rb @@ -1,7 +1,7 @@ module ActiveDomain # Returns the version of the currently loaded ActiveDomain as a Gem::Version def self.version - Gem::Version.new '0.4.1' + Gem::Version.new '0.4.2' end module VERSION #:nodoc: diff --git a/active_event/lib/active_event/version.rb b/active_event/lib/active_event/version.rb index c775422..fd9988f 100644 --- a/active_event/lib/active_event/version.rb +++ b/active_event/lib/active_event/version.rb @@ -1,7 +1,7 @@ module ActiveEvent # Returns the version of the currently loaded ActiveEvent as a Gem::Version def self.version - Gem::Version.new '0.4.1' + Gem::Version.new '0.4.2' end module VERSION #:nodoc: diff --git a/active_projection/lib/active_projection/event_client.rb b/active_projection/lib/active_projection/event_client.rb index 1adf239..8ba1bca 100644 --- a/active_projection/lib/active_projection/event_client.rb +++ b/active_projection/lib/active_projection/event_client.rb @@ -11,6 +11,7 @@ def self.start(options) def start event_connection.start + sync_projections listen_for_events request_missing_events event_channel.work_pool.join @@ -18,6 +19,10 @@ def start puts 'Catching Interrupt' end + def sync_projections + ProjectionTypeRegistry.sync_projections + end + def listen_for_events subscribe_to event_queue do |delivery_info, properties, body| event_received properties, body diff --git a/active_projection/lib/active_projection/projection_type_registry.rb b/active_projection/lib/active_projection/projection_type_registry.rb index b12cd1a..2666f4d 100644 --- a/active_projection/lib/active_projection/projection_type_registry.rb +++ b/active_projection/lib/active_projection/projection_type_registry.rb @@ -20,6 +20,16 @@ def process(headers, event) end end + def self.sync_projections + instance.sync_projections + end + + def sync_projections + projections.each do |projection| + ProjectionRepository.create_or_get(projection.class.name) + end + end + private cattr_accessor :registry diff --git a/active_projection/lib/active_projection/version.rb b/active_projection/lib/active_projection/version.rb index f9e7575..6a86f6c 100644 --- a/active_projection/lib/active_projection/version.rb +++ b/active_projection/lib/active_projection/version.rb @@ -1,7 +1,7 @@ module ActiveProjection # Returns the version of the currently loaded ActiveProjection as a Gem::Version def self.version - Gem::Version.new '0.4.1' + Gem::Version.new '0.4.2' end module VERSION #:nodoc: diff --git a/active_projection/spec/lib/projection_type_registry_spec.rb b/active_projection/spec/lib/projection_type_registry_spec.rb index 64b938a..6e893b5 100644 --- a/active_projection/spec/lib/projection_type_registry_spec.rb +++ b/active_projection/spec/lib/projection_type_registry_spec.rb @@ -20,4 +20,9 @@ class TestProjection expect_any_instance_of(TestProjection).to receive(:invoke).with(event, headers) ActiveProjection::ProjectionTypeRegistry.process(headers, event) end + + it 'synchronizes the known projections with the db' do + expect(ActiveProjection::ProjectionRepository).to receive(:create_or_get).with('TestProjection') + ActiveProjection::ProjectionTypeRegistry.sync_projections + end end diff --git a/drailties/lib/rails-disco/version.rb b/drailties/lib/rails-disco/version.rb index 2df34a1..9eed4c8 100644 --- a/drailties/lib/rails-disco/version.rb +++ b/drailties/lib/rails-disco/version.rb @@ -2,7 +2,7 @@ module RailsDisco module VERSION MAJOR = 0 MINOR = 4 - TINY = 1 + TINY = 2 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") diff --git a/version.rb b/version.rb index 2df34a1..9eed4c8 100644 --- a/version.rb +++ b/version.rb @@ -2,7 +2,7 @@ module RailsDisco module VERSION MAJOR = 0 MINOR = 4 - TINY = 1 + TINY = 2 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")