Last active
August 29, 2015 14:03
-
-
Save Papipo/702986662aab093d449a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "concurrent/actor" | |
class SampleApp < Concurrent::Actor::Context | |
private_class_method :spawn, :spawn! | |
def self.run! | |
spawn!(:sample_app) | |
end | |
def initialize | |
@manager = EventSourcing::Aggregate::Manager.spawn!(name: :aggregate_manager, supervise: true, behaviour: Behaviour.restarting_behaviour) | |
end | |
def on_message(message) | |
case message | |
when :manager | |
@manager | |
end | |
end | |
def default_reference_class | |
Reference | |
end | |
class Reference < Concurrent::Actor::Reference | |
def manager | |
ask(:manager).value | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment