Esempio n. 1
0
 private void OnClosed(IAmqpObject sender, Error error)
 {
     if (error != null)
     {
         _tcs.TrySetException(new CreateTransactionCoordinatorException(error.Description, error.Condition));
     }
 }
Esempio n. 2
0
 private void OnClosed(IAmqpObject sender, Error error)
 {
     if (error != null)
     {
         _tcs.TrySetException(new CreateConsumerException(error.Description, error.Condition));
     }
 }
Esempio n. 3
0
 void OnLinkClosed(IAmqpObject sender, Error error)
 {
     lock (this.queue.publishers)
     {
         this.queue.publishers.Remove(this.id);
     }
 }
Esempio n. 4
0
 void OnConnectionClosed(IAmqpObject sender, Error error)
 {
     lock (this.connections)
     {
         this.connections.Remove((Connection)sender);
     }
 }
Esempio n. 5
0
 private void AmqpObject_Closed(IAmqpObject sender, Error error)
 {
     if (error != null)
     {
         AppLog.Error(string.Format("Connection LOST to endpoint {0}.\r\n\r\n{1}", NetworkUri.ToString(), error.ToString()));
         EnsureConnection();
     }
 }
Esempio n. 6
0
 private void CtsLink_Closed(IAmqpObject sender, Error error)
 {
     if (sender is ListenerLink)
     {
         var listenerLink = sender as ListenerLink;
         System.Console.WriteLine($"CTS link closed.\r\n   LinkName: {listenerLink.Name}\r\n   Details: {error?.Description}");
     }
 }
Esempio n. 7
0
            void OnLinkClosed(IAmqpObject sender, Error error)
            {
                ListenerLink link = (ListenerLink)sender;

                lock (this.collection)
                {
                    this.collection.Remove(link);
                }
            }
 private void OnClosed(IAmqpObject sender, Error error)
 {
     if (sender.Error != null)
     {
         Error             = new DomainEventError();
         Error.Condition   = sender.Error.Condition.ToString();
         Error.Description = sender.Error.Description;
     }
     Closed(this, Error);
 }
Esempio n. 9
0
        private void OnClosed(IAmqpObject sender, Error error)
        {
            Logger.Warn($"AMQP Connection closed: {error.Description}");

            _Connection.Closed   -= OnClosed;
            _Session.Closed      -= OnClosed;
            _ReceiverLink.Closed -= OnClosed;

            Connect();
        }
Esempio n. 10
0
 /// <summary>
 /// Connection closed event handler
 ///
 /// This function provides information only. Calling Reconnect is redundant with
 /// calls from the Run loop.
 /// </summary>
 /// <param name="_">Connection that closed. There is only one connection so this is ignored.</param>
 /// <param name="error">Error object associated with connection close.</param>
 void connectionClosed(IAmqpObject _, Error error)
 {
     if (error == null)
     {
         Trace.WriteLine(TraceLevel.Warning, "Connection closed with no error");
     }
     else
     {
         Trace.WriteLine(TraceLevel.Error, "Connection closed with error: {0}", error.ToString());
     }
 }
 protected override void OnInternalClosed(IAmqpObject sender, Error error)
 {
     if (Tracer.IsDebugEnabled)
     {
         Tracer.DebugFormat("Received Close notification for MessageConsumer {0} {1} {2}",
                            this.Id,
                            IsDurable ? "with subscription name " + this.consumerInfo.SubscriptionName : "",
                            error == null ? "" : "with cause " + error);
     }
     base.OnInternalClosed(sender, error);
     this.OnResponse();
 }
Esempio n. 12
0
 void OnConnectionClosed(IAmqpObject sender, Error error)
 {
     if (this.isImplicit)
     {
         lock (this.syncRoot)
         {
             this.connections.Remove((Connection)sender);
             if (this.connections.Count == 0)
             {
                 this.broker.RemoveQueue(this.address);
             }
         }
     }
 }
Esempio n. 13
0
        private AmqpLink FindLink(IAmqpObject o)
        {
            AmqpLink result = null;

            if (o is SenderLink)
            {
                result = links.Where(l => l.Address == (o as SenderLink).Name).FirstOrDefault();
            }
            if (o is ReceiverLink)
            {
                result = links.Where(l => l.Address == (o as ReceiverLink).Name).FirstOrDefault();
            }
            return(result);
        }
Esempio n. 14
0
 private void AmqpObject_Closed(IAmqpObject sender, Error error)
 {
     if (error != null)
     {
         PostConnectionEvent(ConnectionEvent.ConnectionInterrupted, new Exception(error.ToString()));
         AppLog.Error(string.Format("Connection LOST to endpoint {0}.\r\n\r\n{1}", NetworkUri.ToString(), error.ToString()));
         Close();
         EnsureConnection();
     }
     else
     {
         PostConnectionEvent(ConnectionEvent.ConnectionClosed);
     }
 }
Esempio n. 15
0
 private void Sender_Closed(IAmqpObject sender, Amqp.Framing.Error error)
 {
     if (!_closing)
     {
         var senderLink = (SenderLink)sender;
         var key        =
             _senders.ToArray().Where(pair => pair.Value == senderLink).Select(pair => pair.Key).FirstOrDefault();
         if (key != null)
         {
             SenderLink returnedLink;
             _senders.TryRemove(key, out returnedLink);
         }
     }
 }
Esempio n. 16
0
        void OnControllerClosed(IAmqpObject obj, Error error)
        {
            var  controller = (Controller)obj;
            bool removed;

            lock (this.SyncRoot)
            {
                removed = this.controllers.Remove(controller.Session.Connection);
            }

            if (removed)
            {
                controller.Session.CloseInternal(0);
            }
        }
Esempio n. 17
0
        private void OnClosed(IAmqpObject sender, Error error)
        {
            if (Tracer.IsDebugEnabled)
            {
                Tracer.Debug($"Connection closed. {error}");
            }

            bool connectionExplicitlyClosed = error == null;

            if (!connectionExplicitlyClosed)
            {
                var exception = ExceptionSupport.GetException(error);
                if (!this.tsc.TrySetException(exception))
                {
                    Provider.OnConnectionClosed(exception);
                }
            }
        }
Esempio n. 18
0
            static void OnLinkClosed(IAmqpObject sender, Error error)
            {
                ListenerLink link = (ListenerLink)sender;

                if (!link.Role)
                {
                    var tuple = (Tuple <RequestProcessor, string>)link.State;
                    RemoveProcessor(tuple.Item1.responseLinks, tuple.Item2);
                }
                else
                {
                    var thisPtr = (RequestProcessor)link.State;
                    lock (thisPtr.requestLinks)
                    {
                        thisPtr.requestLinks.Remove(link);
                    }
                }
            }
Esempio n. 19
0
        public static NMSException GetTimeoutException(IAmqpObject obj, string message)
        {
            Error e = null;

            if (obj is Amqp.Connection)
            {
                e = NMSError.CONNECTION_TIMEOUT;
            }
            else if (obj is Amqp.Session)
            {
                e = NMSError.SESSION_TIMEOUT;
            }
            else if (obj is Amqp.Link)
            {
                e = NMSError.LINK_TIMEOUT;
            }

            return(GetException(e, message));
        }
Esempio n. 20
0
        private void OnInternalClosed(IAmqpObject sender, Error error)
        {
            string     name = null;
            Connection self = null;

            try
            {
                self = this;
                // name should throw should the finalizer of the Connection object already completed.
                name = self.ClientId;
                Tracer.InfoFormat("Received Close Request for Connection {0}.", name);
                if (self.state.CompareAndSet(ConnectionState.CONNECTED, ConnectionState.CLOSED))
                {
                    // unexpected or amqp transport close.

                    // notify any error to exception Dispatcher.
                    if (error != null)
                    {
                        NMSException nmse = ExceptionSupport.GetException(error, "Connection {0} Closed.", name);
                        self.OnException(nmse);
                    }

                    // shutdown connection facilities.
                    if (self.IsStarted)
                    {
                        self.Shutdown();
                    }
                    MessageFactory <ConnectionInfo> .Unregister(self);
                }
                else if (self.state.CompareAndSet(ConnectionState.CLOSING, ConnectionState.CLOSED))
                {
                    // application close.
                    MessageFactory <ConnectionInfo> .Unregister(self);
                }
                self.latch?.countDown();
            }
            catch (Exception ex)
            {
                Tracer.DebugFormat("Caught Exception during Amqp Connection close for NMS Connection{0}. Exception {1}",
                                   name != null ? (" " + name) : "", ex);
            }
        }
Esempio n. 21
0
 protected override void OnInternalClosed(IAmqpObject sender, Error error)
 {
     Tracer.InfoFormat("Closed subscription {0} state {1}", this.Info.SubscriptionName, this.State);
     if (error != null && !this.IsOpening && !this.IsClosing)
     {
         if (this.remoteSource == null)
         {
             // ignore detach request
             if (error != null)
             {
                 Tracer.DebugFormat("Received detach request on invalid subscription {0}. Cause for detach : {1}", this.Info.SubscriptionName, error);
             }
         }
         else
         {
             Tracer.WarnFormat("Subscription {0} on connection {1} has been destroyed. Cause {2}", this.Info.SubscriptionName, this.Info.ClientId, error);
         }
     }
     base.OnInternalClosed(sender, error);
     this.OnResponse();
 }
Esempio n. 22
0
 private void Connection_Closed(IAmqpObject sender, Error error)
 {
     status.Text        = "Closed";
     senderLink         = null;
     session            = null;
     connection.Closed -= Connection_Closed;
     connection         = null;
     for (int i = senders.Count - 1; i >= 0; i--)
     {
         senders.RemoveAt(i);
     }
     for (int i = receivers.Count - 1; i >= 0; i--)
     {
         receivers.RemoveAt(i);
     }
     BeginInvoke(new MethodInvoker(() =>
     {
         sendersListBox.DataSource   = null;
         receiversListBox.DataSource = null;
     }));
 }
 internal void OnInternalClosed(IAmqpObject sender, Error error)
 {
     Listener?.OnConnectionFailure(ExceptionSupport.GetException(error));
 }
Esempio n. 24
0
 void OnLinkClosed(IAmqpObject sender, Error error)
 {
     this.Credit = 0;
     this.queue.OnConsumerClosed(this.id, this);
 }
Esempio n. 25
0
 private void ClientConnection_Closed(IAmqpObject sender, Amqp.Framing.Error error)
 {
     System.Console.WriteLine($"Client connection closed.\r\n   Client Tracking Id: {this.TrackingId}\r\n   Details: {error?.Description}");
     AttachedClients.DetachClient(this, error?.Description);
 }
Esempio n. 26
0
 public void ReceiverClosedCallback(IAmqpObject sender, Error error)
 {
     Log.FatalFormat("error.Description:{0}, error.Info:{1}, error:{2}", error.Description, error.Info, error);
 }
Esempio n. 27
0
 void OnLinkClosed(IAmqpObject sender, Error error)
 {
     Console.WriteLine("A client has disconnected.");
     this.timer.Dispose();
 }
Esempio n. 28
0
 void OnChannelClosed(IAmqpObject sender, Error error)
 {
     this.reset.Set();
 }
Esempio n. 29
0
 public static NMSException GetException(IAmqpObject obj, string message = "")
 {
     return(GetException(obj.Error, message));
 }
Esempio n. 30
0
 public static NMSException GetException(IAmqpObject obj, string format, params object[] args)
 {
     return(GetException(obj, string.Format(format, args)));
 }