Sha256: d68daec8e9027495c638e2bc75e184bd9eb1b587f7c842db864d5c3fbcf3d5f0
Contents?: true
Size: 662 Bytes
Versions: 1
Compression:
Stored size: 662 Bytes
Contents
# This class is responsible for dispatching the messages to the appropriate handler. # The handlers must be registered with the dispatcher. # Tha handlers need to be modules that implement the process method. # What handler to dispatch the message to is figured out from the subject of the message. module DispatchRider class Dispatcher extend Forwardable attr_reader :handler_registrar def_delegators :handler_registrar, :register, :fetch, :unregister def initialize @handler_registrar = Registrars::Handler.new end def dispatch(message) handler_registrar.fetch(message.subject).process(message.body) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dispatch-rider-0.0.3 | lib/dispatch-rider/dispatcher.rb |