本文整理汇总了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;
}
示例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));
}
}
示例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);
}
}
示例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;
}
示例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);
});
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例14: HandleModelShutdown
public virtual void HandleModelShutdown(ShutdownEventArgs reason)
{
m_cell.Value = Either.Right(reason);
}
示例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();
}