當前位置: 首頁>>代碼示例>>C#>>正文


C# Events.CallbackExceptionEventArgs類代碼示例

本文整理匯總了C#中RabbitMQ.Client.Events.CallbackExceptionEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# CallbackExceptionEventArgs類的具體用法?C# CallbackExceptionEventArgs怎麽用?C# CallbackExceptionEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CallbackExceptionEventArgs類屬於RabbitMQ.Client.Events命名空間,在下文中一共展示了CallbackExceptionEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RecoverConsumers

        protected void RecoverConsumers()
        {
            foreach (KeyValuePair<string, RecordedConsumer> pair in m_recordedConsumers)
            {
                string tag = pair.Key;
                RecordedConsumer cons = pair.Value;

                try
                {
                    string newTag = cons.Recover();
                    lock (m_recordedConsumers)
                    {
                        // make sure server-generated tags are re-added
                        m_recordedConsumers.Remove(tag);
                        m_recordedConsumers.Add(newTag, cons);
                    }

                    if (m_consumerTagChange != null)
                    {
                        foreach (EventHandler<ConsumerTagChangedAfterRecoveryEventArgs> h in m_consumerTagChange.GetInvocationList())
                        {
                            try
                            {
                                var eventArgs = new ConsumerTagChangedAfterRecoveryEventArgs(tag, newTag);
                                h(this, eventArgs);
                            }
                            catch (Exception e)
                            {
                                var args = new CallbackExceptionEventArgs(e);
                                args.Detail["context"] = "OnConsumerRecovery";
                                m_delegate.OnCallbackException(args);
                            }
                        }
                    }
                }
                catch (Exception cause)
                {
                    string s = String.Format("Caught an exception while recovering consumer {0} on queue {1}: {2}",
                        tag, cons.Queue, cause.Message);
                    HandleTopologyRecoveryException(new TopologyRecoveryException(s, cause));
                }
            }
        }
開發者ID:rabbitmq,項目名稱:rabbitmq-dotnet-client,代碼行數:43,代碼來源:AutorecoveringConnection.cs

示例2: RecoverQueues

        protected void RecoverQueues()
        {
            lock (m_recordedQueues)
            {
                foreach (KeyValuePair<string, RecordedQueue> pair in m_recordedQueues)
                {
                    string oldName = pair.Key;
                    RecordedQueue rq = pair.Value;

                    try
                    {
                        rq.Recover();
                        string newName = rq.Name;

                        // Make sure server-named queues are re-added with
                        // their new names.
                        // We only remove old name after we've updated the bindings and consumers,
                        // plus only for server-named queues, both to make sure we don't lose
                        // anything to recover. MK.
                        PropagateQueueNameChangeToBindings(oldName, newName);
                        PropagateQueueNameChangeToConsumers(oldName, newName);
                        // see rabbitmq/rabbitmq-dotnet-client#43
                        if (rq.IsServerNamed)
                        {
                            DeleteRecordedQueue(oldName);
                        }
                        RecordQueue(newName, rq);

                        if (m_queueNameChange != null)
                        {
                            foreach (EventHandler<QueueNameChangedAfterRecoveryEventArgs> h in m_queueNameChange.GetInvocationList())
                            {
                                try
                                {
                                    var eventArgs = new QueueNameChangedAfterRecoveryEventArgs(oldName, newName);
                                    h(this, eventArgs);
                                }
                                catch (Exception e)
                                {
                                    var args = new CallbackExceptionEventArgs(e);
                                    args.Detail["context"] = "OnQueueRecovery";
                                    m_delegate.OnCallbackException(args);
                                }
                            }
                        }
                    }
                    catch (Exception cause)
                    {
                        string s = String.Format("Caught an exception while recovering queue {0}: {1}",
                            oldName, cause.Message);
                        HandleTopologyRecoveryException(new TopologyRecoveryException(s, cause));
                    }
                }
            }
        }
開發者ID:rabbitmq,項目名稱:rabbitmq-dotnet-client,代碼行數:55,代碼來源:AutorecoveringConnection.cs

示例3: HandleBasicDeliver

        public void HandleBasicDeliver(string consumerTag,
                                       ulong deliveryTag,
                                       bool redelivered,
                                       string exchange,
                                       string routingKey,
                                       IBasicProperties basicProperties,
                                       byte[] body)
        {
            IBasicConsumer consumer;
            lock (m_consumers)
            {
                consumer = (IBasicConsumer)m_consumers[consumerTag];
            }
            if (consumer == null)
            {
                if (DefaultConsumer == null) {
                    throw new InvalidOperationException("Unsolicited delivery -" +
                                                        " see IModel.DefaultConsumer to handle this" +
                                                        " case.");
                }
                else {
                    consumer = DefaultConsumer;
                }
            }

            try {
                consumer.HandleBasicDeliver(consumerTag,
                                            deliveryTag,
                                            redelivered,
                                            exchange,
                                            routingKey,
                                            basicProperties,
                                            body);
            } catch (Exception e) {
                CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
                args.Detail["consumer"] = consumer;
                args.Detail["context"] = "HandleBasicDeliver";
                OnCallbackException(args);
            }
        }
開發者ID:DarthZar,項目名稱:rabbitmq-dotnet-client,代碼行數:40,代碼來源:ModelBase.cs

示例4: ModelOnCallbackException

 private void ModelOnCallbackException(object sender, CallbackExceptionEventArgs e)
 {
     _logger.Error($"Callback exception: {e.Exception}");
 }
開發者ID:rabbit-link,項目名稱:rabbit-link,代碼行數:4,代碼來源:LinkChannel.cs

示例5: OnBasicAck

        public virtual void OnBasicAck(BasicAckEventArgs args)
        {
            BasicAckEventHandler handler;
            lock (m_eventLock)
            {
                handler = m_basicAck;
            }
            if (handler != null)
            {
                foreach (BasicAckEventHandler h in handler.GetInvocationList()) {
                    try {
                        h(this, args);
                    } catch (Exception e) {
                        CallbackExceptionEventArgs exnArgs = new CallbackExceptionEventArgs(e);
                        exnArgs.Detail["context"] = "OnBasicAck";
                        OnCallbackException(exnArgs);
                    }
                }
            }

            handleAckNack(args.DeliveryTag, args.Multiple, false);
        }
開發者ID:DarthZar,項目名稱:rabbitmq-dotnet-client,代碼行數:22,代碼來源:ModelBase.cs

示例6: OnFlowControl

 public virtual void OnFlowControl(FlowControlEventArgs args)
 {
     FlowControlEventHandler handler;
     lock (m_eventLock)
     {
         handler = m_flowControl;
     }
     if (handler != null)
     {
         foreach (FlowControlEventHandler h in handler.GetInvocationList())
         {
             try
             {
                 h(this, args);
             }
             catch (Exception e)
             {
                 CallbackExceptionEventArgs exnArgs = new CallbackExceptionEventArgs(e);
                 exnArgs.Detail["context"] = "OnFlowControl";
                 OnCallbackException(exnArgs);
             }
         }
     }
 }
開發者ID:DarthZar,項目名稱:rabbitmq-dotnet-client,代碼行數:24,代碼來源:ModelBase.cs

示例7: HandleBasicDeliver

        public void HandleBasicDeliver(string consumerTag,
                                       ulong deliveryTag,
                                       bool redelivered,
                                       string exchange,
                                       string routingKey,
                                       IBasicProperties basicProperties,
                                       byte[] body)
        {
            IBasicConsumer consumer;
            lock (m_consumers)
            {
                consumer = (IBasicConsumer)m_consumers[consumerTag];
            }
            if (consumer == null)
            {
                // FIXME: what is an appropriate thing to do here?
                throw new NotSupportedException("FIXME unsolicited delivery for consumer tag " + consumerTag);
            }

            try {
                consumer.HandleBasicDeliver(consumerTag,
                                            deliveryTag,
                                            redelivered,
                                            exchange,
                                            routingKey,
                                            basicProperties,
                                            body);
            } catch (Exception e) {
                CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
                args.Detail["consumer"] = consumer;
                args.Detail["context"] = "HandleBasicDeliver";
                OnCallbackException(args);
            }
        }
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:34,代碼來源:ModelBase.cs

示例8: HandleBasicCancelOk

        public void HandleBasicCancelOk(string consumerTag)
        {
            BasicConsumerRpcContinuation k =
                (BasicConsumerRpcContinuation)m_continuationQueue.Next();

            Trace.Assert(k.m_consumerTag == consumerTag, string.Format(
                                                                       "Consumer tag mismatch during cancel: {0} != {1}",
                                                                       k.m_consumerTag,
                                                                       consumerTag
                                                                       ));

            lock (m_consumers)
            {
                k.m_consumer = (IBasicConsumer)m_consumers[consumerTag];
                m_consumers.Remove(consumerTag);
            }
            try {
                k.m_consumer.HandleBasicCancelOk(consumerTag);
            } catch (Exception e) {
                // FIXME: should we propagate the exception to the
                // caller of BasicCancel?
                CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
                args.Detail["consumer"] = k.m_consumer;
                args.Detail["context"] = "HandleBasicCancelOk";
                OnCallbackException(args);
            }
            k.HandleCommand(null); // release the continuation.
        }
開發者ID:DarthZar,項目名稱:rabbitmq-dotnet-client,代碼行數:28,代碼來源:ModelBase.cs

示例9: ThrowingConnectionCallbackException

 private void ThrowingConnectionCallbackException(object sender, CallbackExceptionEventArgs e)
 {
     log.Debug("Throwing exception in connection callback exception handler");
     throw new Exception();
 }
開發者ID:simoneb,項目名稱:Roger,代碼行數:5,代碼來源:Shutdown_protocol.cs

示例10: ThrowingModelOnCallbackException

 private void ThrowingModelOnCallbackException(object sender, CallbackExceptionEventArgs e)
 {
     log.Debug("Throwing exception in model callback exception handler");
     throw new Exception();
 }
開發者ID:simoneb,項目名稱:Roger,代碼行數:5,代碼來源:Shutdown_protocol.cs

示例11: OnConnectionUnblocked

 public void OnConnectionUnblocked()
 {
       ConnectionUnblockedEventHandler handler;
       lock (m_eventLock)
       {
           handler = m_connectionUnblocked;
       }
       if (handler != null)
       {
           foreach (ConnectionUnblockedEventHandler h in handler.GetInvocationList()) {
               try {
                   h(this);
               } catch (Exception e) {
                   CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
                   args.Detail["context"] = "OnConnectionUnblocked";
                   OnCallbackException(args);
               }
           }
       }
 }
開發者ID:DarthZar,項目名稱:rabbitmq-dotnet-client,代碼行數:20,代碼來源:ConnectionBase.cs

示例12: CallbackExceptionHandler

 private void CallbackExceptionHandler(object sender, CallbackExceptionEventArgs e)
 {
     this.CallbackException?.Invoke(sender, e);
 }
開發者ID:dkearney1,項目名稱:Default,代碼行數:4,代碼來源:ChannelBase.cs

示例13: OnCallbackException

 private void OnCallbackException(object sender, CallbackExceptionEventArgs e)
 {
     Log.Error(e.Exception, "Callback exception on RabbitMQ.Client");
 }
開發者ID:ReactiveServices,項目名稱:ReactiveServices.MessageBus.RabbitMQ,代碼行數:4,代碼來源:RabbitMQChannel.cs

示例14: OnShutdown

 ///<summary>Broadcasts notification of the final shutdown of the connection.</summary>
 public void OnShutdown()
 {
     ConnectionShutdownEventHandler handler;
     ShutdownEventArgs reason;
     lock (m_eventLock)
     {
         handler = m_connectionShutdown;
         reason = m_closeReason;
         m_connectionShutdown = null;
     }
     if (handler != null)
     {
         foreach (ConnectionShutdownEventHandler h in handler.GetInvocationList()) {
             try {
                 h(this, reason);
             } catch (Exception e) {
                 CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
                 args.Detail["context"] = "OnShutdown";
                 OnCallbackException(args);
             }
         }
     }
     AppDomain.CurrentDomain.DomainUnload -= HandleDomainUnload;
 }
開發者ID:parshim,項目名稱:rabbitmq-dotnet-client,代碼行數:25,代碼來源:ConnectionBase.cs

示例15: OnCallbackException

 public virtual void OnCallbackException(CallbackExceptionEventArgs args)
 {
     m_delegate.OnCallbackException(args);
 }
開發者ID:ru-sh,項目名稱:rabbitmq-dotnet-client,代碼行數:4,代碼來源:AutorecoveringModel.cs


注:本文中的RabbitMQ.Client.Events.CallbackExceptionEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。