本文整理匯總了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));
}
}
}
示例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));
}
}
}
}
示例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);
}
}
示例4: ModelOnCallbackException
private void ModelOnCallbackException(object sender, CallbackExceptionEventArgs e)
{
_logger.Error($"Callback exception: {e.Exception}");
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
}
示例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.
}
示例9: ThrowingConnectionCallbackException
private void ThrowingConnectionCallbackException(object sender, CallbackExceptionEventArgs e)
{
log.Debug("Throwing exception in connection callback exception handler");
throw new Exception();
}
示例10: ThrowingModelOnCallbackException
private void ThrowingModelOnCallbackException(object sender, CallbackExceptionEventArgs e)
{
log.Debug("Throwing exception in model callback exception handler");
throw new Exception();
}
示例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);
}
}
}
}
示例12: CallbackExceptionHandler
private void CallbackExceptionHandler(object sender, CallbackExceptionEventArgs e)
{
this.CallbackException?.Invoke(sender, e);
}
示例13: OnCallbackException
private void OnCallbackException(object sender, CallbackExceptionEventArgs e)
{
Log.Error(e.Exception, "Callback exception on RabbitMQ.Client");
}
示例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;
}
示例15: OnCallbackException
public virtual void OnCallbackException(CallbackExceptionEventArgs args)
{
m_delegate.OnCallbackException(args);
}