Skip to content

Instantly share code, notes, and snippets.

@Papipo
Last active August 29, 2015 14:03
Show Gist options
  • Save Papipo/702986662aab093d449a to your computer and use it in GitHub Desktop.
Save Papipo/702986662aab093d449a to your computer and use it in GitHub Desktop.
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