Exemplo n.º 1
0
        private void InvokeRpcMethod(IInvocation invocation)
        {
            var rpcMethod = _serviceType.GetMethod(invocation.Method.Name, invocation.Method.GetParameters().Select(p => p.ParameterType).ToArray());

            if (rpcMethod == null)
            {
                throw new InvalidOperationException(string.Format("Cannot invoke method [{0}].", invocation.Method.Name));
            }

            var methodLocator = _fixture.Extractor.Extract(rpcMethod);

            var message = new InvokeMethodMessage()
            {
                MethodLocator   = methodLocator,
                MethodArguments = invocation.Arguments,
            };

            message.Serialize(_fixture.ArgumentEncoder);

            var service = _serviceResolver.Resolve(_serviceType, _strategy);

            _handler.Send(service.Type, service.Name, message);
        }