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


C# Client.ShutdownEventArgs類代碼示例

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


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

示例1: QuiescingSession

 public QuiescingSession(Connection connection,
     int channelNumber,
     ShutdownEventArgs reason)
     : base(connection, channelNumber)
 {
     m_reason = reason;
 }
開發者ID:nbsynch,項目名稱:rabbitmq-dotnet-client,代碼行數:7,代碼來源:QuiescingSession.cs

示例2: SetUp

        public void SetUp()
        {
            persistentConnection = MockRepository.GenerateStub<IPersistentConnection>();
            channel = MockRepository.GenerateStub<IModel>();
            var eventBus = new EventBus();
            var configuration = new ConnectionConfiguration();

            var shutdownArgs = new ShutdownEventArgs(
                ShutdownInitiator.Peer, 
                AmqpException.ConnectionClosed,
                "connection closed by peer");
            var exception = new OperationInterruptedException(shutdownArgs);
            var first = true;

            persistentConnection.Stub(x => x.CreateModel()).WhenCalled(x =>
                {
                    if (first)
                    {
                        first = false;
                        throw exception;
                    }
                    x.ReturnValue = channel;
                });

            var logger = MockRepository.GenerateStub<IEasyNetQLogger>();

            persistentChannel = new PersistentChannel(persistentConnection, logger, configuration, eventBus);

            new Timer(_ => eventBus.Publish(new ConnectionCreatedEvent())).Change(10, Timeout.Infinite);

            persistentChannel.InvokeChannelAction(x => x.ExchangeDeclare("MyExchange", "direct"));
        }
開發者ID:akzhigitov,項目名稱:EasyNetQ,代碼行數:32,代碼來源:When_an_action_is_performed_on_a_closed_channel_that_then_opens.cs

示例3: HandleModelShutdown

 public void HandleModelShutdown(IModel model, ShutdownEventArgs reason)
 {
     if (ModelShutdown != null)
     {
         ModelShutdown(this, new ModelShutdownEventArgs(model, reason));
     }
 }
開發者ID:nordbergm,項目名稱:NSimpleBus,代碼行數:7,代碼來源:QueueActivityConsumer.cs

示例4: SetUp

        public void SetUp()
        {
            persistentConnection = MockRepository.GenerateStub<IPersistentConnection>();
            var eventBus = MockRepository.GenerateStub<IEventBus>();

            var configuration = new ConnectionConfiguration
                {
                    Timeout = 1
                };

            var shutdownArgs = new ShutdownEventArgs(
                ShutdownInitiator.Peer,
                AmqpException.ConnectionClosed,
                "connection closed by peer");
            var exception = new OperationInterruptedException(shutdownArgs);

            persistentConnection.Stub(x => x.CreateModel()).WhenCalled(x =>
                {
                    throw exception;
                });

            var logger = MockRepository.GenerateStub<IEasyNetQLogger>();

            persistentChannel = new PersistentChannel(persistentConnection, logger, configuration, eventBus);

        }
開發者ID:hippasus,項目名稱:EasyNetQ,代碼行數:26,代碼來源:When_an_action_is_performed_on_a_closed_channel_that_doesnt_open_again.cs

示例5: ConnectionShutdown

        private void ConnectionShutdown(IConnection connection, ShutdownEventArgs reason)
        {
            if (Disconnected != null) Disconnected();

            _watcher.WarnFormat("Disconnected from RabbitMQ Broker");

            if (reason != null && reason.ReplyText != "Connection disposed by application")
            {
                _retryPolicy.WaitForNextRetry(Connect);
            }
        }
開發者ID:danielrmz,項目名稱:Burrow.NET,代碼行數:11,代碼來源:DurableConnection.cs

示例6: QuiescingSession

 public QuiescingSession(ConnectionBase connection,
                         int channelNumber,
                         ShutdownEventArgs reason,
                         int replyClassId,
                         int replyMethodId)
     : base(connection, channelNumber)
 {
     m_reason = reason;
     m_replyClassId = replyClassId;
     m_replyMethodId = replyMethodId;
 }
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:11,代碼來源:QuiescingSession.cs

示例7: SetUp

        public void SetUp()
        {
            mockBuilder = new MockBuilder("host=localhost;timeout=1");

            mockBuilder.NextModel
                .Stub(x => x.ExchangeDeclare(null, null, false, false, null))
                .IgnoreArguments()
                .WhenCalled(x =>
                    {
                        var args = new ShutdownEventArgs(ShutdownInitiator.Peer, 320, 
                            "CONNECTION_FORCED - Closed via management plugin");
                        throw new OperationInterruptedException(args);
                    });
        }
開發者ID:hippasus,項目名稱:EasyNetQ,代碼行數:14,代碼來源:When_IModel_throws.cs

示例8: Connection_ConnectionShutdown

 void Connection_ConnectionShutdown(object source, ShutdownEventArgs reason)
 {
     consumer.ConnectionLost -= Connection_ConnectionShutdown;
     log.Debug("CarService: Connection lost to RabbitMQ Server due to {0}", reason.Cause);
     try
     {
         consumer.StopConsuming();
     }
     catch (Exception ex)
     {
         log.Warning(ex, "CarService: Shutting down old connection to allow new connection to replace it");
     }
     InitializeQueueConnection();
     ProcessingService.StartConsumer();
 }
開發者ID:jhonner72,項目名稱:plat,代碼行數:15,代碼來源:CarService.cs

示例9: ConnectionShutdown

 void ConnectionShutdown(IConnection connection, ShutdownEventArgs reason)
 {
     "The connection to the rabbitmq node is shutting down. \r\n\t Class: {0} \r\n\t Method: {1} \r\n\t Cause: {2} \r\n\t Reply {3}: {4}"
         .ToError<IBus>
         (
             reason.ClassId,
             reason.MethodId,
             reason.Cause,
             reason.ReplyCode,
             reason.ReplyText
         );
     connection.ConnectionShutdown -= ConnectionShutdown;
     _connection = null;
     connection.Dispose();
     connection = null;
 }
開發者ID:jcowart,項目名稱:Symbiote,代碼行數:16,代碼來源:ConnectionManager.cs

示例10: OnSessionShutdown

 public virtual void OnSessionShutdown(ShutdownEventArgs reason)
 {
     //Console.WriteLine("Session shutdown "+ChannelNumber+": "+reason);
     m_connection.ConnectionShutdown -=
         new ConnectionShutdownEventHandler(this.OnConnectionShutdown);
     SessionShutdownEventHandler handler;
     lock (m_shutdownLock)
     {
         handler = m_sessionShutdown;
         m_sessionShutdown = null;
     }
     if (handler != null)
     {
         handler(this, reason);
     }
 }
開發者ID:DarthZar,項目名稱:rabbitmq-dotnet-client,代碼行數:16,代碼來源:SessionBase.cs

示例11: SharedConnectionShutdown

        private void SharedConnectionShutdown(IConnection connection, ShutdownEventArgs reason)
        {
            if (Disconnected != null) Disconnected();

            _watcher.WarnFormat("Disconnected from RabbitMQ Broker");

            foreach(var c in SharedConnections)
            {
                if (c.Key == ConnectionFactory.Endpoint + ConnectionFactory.VirtualHost)
                {
                    SharedConnections.Remove(c.Key);
                    break;
                }
            }

            if (reason != null && reason.ReplyText != "Connection disposed by application" && reason.ReplyText != Subscription.CloseByApplication)
            {
                _retryPolicy.WaitForNextRetry(Connect);
            }
        }
開發者ID:sovanesyan,項目名稱:Burrow.NET,代碼行數:20,代碼來源:DurableConnection.cs

示例12: SetUp

        public void SetUp()
        {
            persistentConnection = MockRepository.GenerateStub<IPersistentConnection>();
            channel = MockRepository.GenerateStub<IModel>();
            var eventBus = new EventBus();
            var configuration = new ConnectionConfiguration();

            var shutdownArgs = new ShutdownEventArgs(
                ShutdownInitiator.Peer,
                AmqpException.ConnectionClosed,
                "connection closed by peer");
            var exception = new OperationInterruptedException(shutdownArgs);

            persistentConnection.Stub(x => x.CreateModel()).Throw(exception).Repeat.Once();
            persistentConnection.Stub(x => x.CreateModel()).Return(channel).Repeat.Any();

            var logger = MockRepository.GenerateStub<IEasyNetQLogger>();

            persistentChannel = new PersistentChannel(persistentConnection, logger, configuration, eventBus);

            new Timer(_ => eventBus.Publish(new ConnectionCreatedEvent())).Change(10, Timeout.Infinite);

            persistentChannel.InvokeChannelAction(x => x.ExchangeDeclare("MyExchange", "direct"),DateTime.UtcNow );
        }
開發者ID:btaylor1,項目名稱:EasyNetQ,代碼行數:24,代碼來源:When_an_action_is_performed_on_a_closed_channel_that_then_opens.cs

示例13: HandleModelShutdown

 /// <summary>
 /// Handle model shutdown, given a consumerTag.
 /// </summary>
 /// <param name="consumerTag">
 /// The consumer tag.
 /// </param>
 /// <param name="sig">
 /// The sig.
 /// </param>
 public void HandleModelShutdown(string consumerTag, ShutdownEventArgs sig)
 {
     if (this.logger.IsDebugEnabled)
     {
         logger.Debug("Received shutdown signal for consumer tag=" + consumerTag + " , cause=" + sig.Cause);
     }
     outer.shutdown = sig;
 }
開發者ID:DonMcRae,項目名稱:spring-net-amqp,代碼行數:17,代碼來源:BlockingQueueConsumer.cs

示例14: HandleModelShutdown

 public virtual void HandleModelShutdown(ShutdownEventArgs reason)
 {
     m_cell.Value = Either.Right(reason);
 }
開發者ID:DarthZar,項目名稱:rabbitmq-dotnet-client,代碼行數:4,代碼來源:SimpleBlockingRpcContinuation.cs

示例15: InternalClose

        public void InternalClose(ShutdownEventArgs reason)
        {
            if (!SetCloseReason(reason))
            {
                if (m_closed)
                    throw new AlreadyClosedException(m_closeReason);
                // We are quiescing, but still allow for server-close
            }

            OnShutdown();
            m_session0.SetSessionClosing(true);
            TerminateMainloop();
        }
開發者ID:parshim,項目名稱:rabbitmq-dotnet-client,代碼行數:13,代碼來源:ConnectionBase.cs


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