def dispatch(request)
      token = request.token
      actor, method, idempotent = route(request)
      received_at = @request_stats.update(method, (token if request.is_a?(Request)))
      if (dup = duplicate?(request, method, idempotent))
        raise DuplicateRequest, dup
      end
      unless (result = expired?(request, method))
        result = perform(request, actor, method, idempotent)
      end
      if request.is_a?(Request)
        duration = @request_stats.finish(received_at, token)
        Result.new(token, request.reply_to, result, @identity, request.from, request.tries, request.persistent, duration)
      end
    end
def dispatch(request)
      token = request.token
      actor, method, idempotent = route(request)
      received_at = @request_stats.update(method, (token if request.is_a?(Request)))
      if (dup = duplicate?(request, method, idempotent))
        raise DuplicateRequest, dup
      end
      unless (result = expired?(request, method))
        result = perform(request, actor, method, idempotent)
      end
      if request.is_a?(Request)
        duration = @request_stats.finish(received_at, token)
        Result.new(token, request.reply_to, result, @identity, request.from, request.tries, request.persistent, duration)
      end
    end
def dispatch ( request ) token = request . token actor , method , idempotent = route ( request ) received_at = @request_stats . update ( method , ( token if request . is_a? ( Request ) ) ) if ( dup = duplicate? ( request , method , idempotent ) ) raise DuplicateRequest , dup end unless ( result = expired? ( request , method ) ) result = perform ( request , actor , method , idempotent ) end if request . is_a? ( Request ) duration = @request_stats . finish ( received_at , token ) Result . new ( token , request . reply_to , result , @identity , request . from , request . tries , request . persistent , duration ) end end
Route request to appropriate actor for servicing
 Reject requests whose TTL has expired or that are duplicates of work already dispatched

 === Parameters
 request(Request|Push):: Packet containing request
 header(AMQP::Frame::Header|nil):: Request header containing ack control

 === Return
 (Result|nil):: Result of request, or nil if there is no result because request is a Push

 === Raise
 InvalidRequestType:: If the request cannot be routed to an actor
 DuplicateRequest:: If request rejected because it has already been processed
Route request to appropriate actor for servicing Reject requests whose TTL has expired or that are duplicates of work already dispatched