当前位置: 首页>>代码示例>>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;未经允许,请勿转载。