Example #1
0
 private void HandleX2XServiceInvocation(X2XServiceInvocation x)
 {
     logger.Trace($"{nameof(HandleX2XServiceInvocation)} for service {x.ServiceGuid} iid {x.InvocationId} method {x.MethodName}");
     Task.Factory.StartNew((dummy) => {
         object result;
         try {
             if (localServiceContainer.TryInvoke(x.ServiceGuid, x.MethodName, x.GenericArguments, x.MethodArguments, out result))
             {
                 logger.Trace($"Successfully locally invoked service {x.ServiceGuid} method {x.MethodName} for iid {x.InvocationId}.");
             }
             else
             {
                 logger.Trace($"Could not locally find service {x.ServiceGuid} method {x.MethodName} for iid {x.InvocationId}.");
                 result = new PortableException(new ServiceUnavailableException(x.ServiceGuid, x.MethodName));
             }
         } catch (Exception e) {
             logger.Trace($"Local invocation for service {x.ServiceGuid} method {x.MethodName} for iid {x.InvocationId} threw ", e);
             if (e is IPortableObject)
             {
                 result = e;
             }
             else
             {
                 result = new PortableException(e);
             }
         }
         messageSender.SendInvocationResultAsync(x.InvocationId, result);
     }, CancellationToken.None, TaskCreationOptions.LongRunning);
 }
Example #2
0
 internal void HandleX2XServiceInvocation(X2XServiceInvocation x)
 {
     logger.Trace($"Invoking service {x.ServiceGuid} method {x.MethodName} with {x.MethodArguments.Length} arguments");
     Task.Factory.StartNew(async(dummy) => {
         try {
             var result   = await hostContext.Invoke(x.ServiceGuid, x.MethodName, x.GenericArguments, x.MethodArguments);
             var sendTask = messageSender.SendInvocationResultAsync(x.InvocationId, result);
         } catch (Exception e) {
             logger.Error(e);
         }
     }, CancellationToken.None, TaskCreationOptions.LongRunning);
 }