Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
* new projections will now be populated at the start of the projectio…
Browse files Browse the repository at this point in the history
…nserver and not with the first incoming event
  • Loading branch information
Robert Kranz committed Dec 18, 2013
1 parent afce354 commit 5b75361
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion RAILS-DISCO_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.1
0.4.2
2 changes: 1 addition & 1 deletion active_domain/lib/active_domain/version.rb
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion active_event/lib/active_event/version.rb
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
5 changes: 5 additions & 0 deletions active_projection/lib/active_projection/event_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ def self.start(options)

def start
event_connection.start
sync_projections
listen_for_events
request_missing_events
event_channel.work_pool.join
rescue Interrupt
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion active_projection/lib/active_projection/version.rb
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
5 changes: 5 additions & 0 deletions active_projection/spec/lib/projection_type_registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion drailties/lib/rails-disco/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(".")
Expand Down
2 changes: 1 addition & 1 deletion version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(".")
Expand Down

0 comments on commit 5b75361

Please sign in to comment.