Ejemplo n.º 1
0
 protected virtual void TryReconnect(IModel disconnectedChannel, Guid id, ShutdownEventArgs eventArgs)
 {
     _createdChannels.Remove(disconnectedChannel);
     if (eventArgs.ReplyCode == 406 && eventArgs.ReplyText.StartsWith("PRECONDITION_FAILED - unknown delivery tag "))
     {
         _watcher.InfoFormat("Trying to re-subscribe to queue after 2 seconds ...");
         var timerState = new TimeSubscription();
         var timer      = new Timer(o => ExecuteSubscription(((TimeSubscription)o)), timerState, 2000, Timeout.Infinite);
         timerState.SubscriptionId = id;
         timerState.Timer          = timer;
         _createdTimer.Add(timer);
     }
 }
Ejemplo n.º 2
0
 internal void ExecuteSubscription(TimeSubscription state)
 {
     try
     {
         _subscribeActions[state.SubscriptionId]();
         if (state.Timer != null)
         {
             state.Timer.Dispose();
         }
     }
     catch (Exception ex)
     {
         _watcher.Error(ex);
     }
 }