class Amazon::Coral::Dispatcher
Dispatches requests to a particular remote service operation.
Public Class Methods
new(orchestrator, service_name, operation_name)
click to toggle source
Instantiates a Dispatcher
with the specified Orchestrator
and strings declaring the service and operation to which requests will be directed.
# File lib/amazon/coral/dispatcher.rb, line 13 def initialize(orchestrator, service_name, operation_name) @orchestrator = orchestrator @service_name = service_name @operation_name = operation_name end
Public Instance Methods
dispatch(call, input)
click to toggle source
Invoke the remote service and produce a result for the provided Call
object and input hash.
# File lib/amazon/coral/dispatcher.rb, line 21 def dispatch(call, input) request = { :operation_name => @operation_name, :service_name => @service_name, :identity => call.identity, :id => call.request_id, :value => input } reply = @orchestrator.orchestrate(request) return reply[:value] end