Papipo/event_sourcing

View on GitHub
lib/event_sourcing/command/bus.rb

Summary

Maintainability
A
0 mins
Test Coverage
require "concurrent/actor"
require "event_sourcing/command"

module EventSourcing
  class Command
    class Bus < Concurrent::Actor::RestartingContext

      def initialize(aggregate_manager)
        @aggregate_manager = aggregate_manager
      end

      def on_message(command)
        command.execute(@aggregate_manager)
      end
    end
  end
end