Sha256: a3ae6aeab93ab2652683952f839120ff784127efdff19e81ebdfa22cdd842906
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
module Aggro module Handler # Private: Handler for incoming command requests. class StartSaga < Struct.new(:message, :server) def call locator.local? ? handle_local : handle_foreign end private def create_channel channel = Channel.new message.id, 'Aggro::SagaRunner' Aggro.channels[message.id] = channel end def create_saga Aggro.store.create message.id, 'Aggro::SagaRunner' end def locator @locator ||= Locator.new(message.id) end def handle_foreign locator.primary_node.client.post message end def handle_known create_saga create_channel Aggro.channels[message.id].forward_command start_command Message::OK.new end def handle_local saga_known? ? handle_known : handle_unknown end def handle_unknown Message::UnknownOperation.new end def saga_known? ActiveSupport::Inflector.safe_constantize message.name end def start_command SagaRunner::StartSaga.new name: message.name, details: message.args, id: message.id end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aggro-0.0.4 | lib/aggro/handler/start_saga.rb |
aggro-0.0.3 | lib/aggro/handler/start_saga.rb |
aggro-0.0.2 | lib/aggro/handler/start_saga.rb |