Ejemplo n.º 1
0
        private void ProcessAsyncResponses(CancellationToken token)
        {
            try
            {
                foreach (var messageContext in asyncQueue.GetConsumingEnumerable(token))
                {
                    try
                    {
                        foreach (var messageOut in messageContext.OutMessages.Cast <Message>())
                        {
                            messageOut.SetDomain(securityProvider.GetDomain(messageOut.Identity));
                            messageOut.RegisterCallbackPoint(messageContext.CallbackReceiverNodeIdentity,
                                                             messageContext.CallbackReceiverIdentity,
                                                             messageContext.CallbackPoint,
                                                             messageContext.CallbackKey);
                            messageOut.SetCorrelationId(messageContext.CorrelationId);
                            messageOut.CopyMessageRouting(messageContext.MessageHops);
                            messageOut.TraceOptions |= messageContext.TraceOptions;

                            localRouterSocket.Send(messageOut);

                            ResponseSent(messageOut, false);
                        }
                    }
                    catch (Exception err)
                    {
                        logger.Error(err);
                    }
                }
            }
            finally
            {
                asyncQueue.Dispose();
            }
        }
Ejemplo n.º 2
0
 private void RegisterActors(CancellationToken token)
 {
     try
     {
         foreach (var registration in actorRegistrationsQueue.GetConsumingEnumerable(token))
         {
             try
             {
                 SendActorRegistrationMessage(registration);
             }
             catch (Exception err)
             {
                 logger.Error(err);
             }
         }
     }
     finally
     {
         actorRegistrationsQueue.Dispose();
     }
 }