1 // This source code is dual-licensed under the Apache License, version
2 // 2.0, and the Mozilla Public License, version 1.1.
6 //---------------------------------------------------------------------------
7 // Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
8 // Technologies LLC., and Rabbit Technologies Ltd.
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
14 // http://www.apache.org/licenses/LICENSE-2.0
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //---------------------------------------------------------------------------
25 //---------------------------------------------------------------------------
26 // The contents of this file are subject to the Mozilla Public License
27 // Version 1.1 (the "License"); you may not use this file except in
28 // compliance with the License. You may obtain a copy of the License at
29 // http://www.rabbitmq.com/mpl.html
31 // Software distributed under the License is distributed on an "AS IS"
32 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
33 // License for the specific language governing rights and limitations
36 // The Original Code is The RabbitMQ .NET Client.
38 // The Initial Developers of the Original Code are LShift Ltd,
39 // Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
41 // Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
42 // Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
43 // are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
44 // Technologies LLC, and Rabbit Technologies Ltd.
46 // Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
47 // Ltd. Portions created by Cohesive Financial Technologies LLC are
48 // Copyright (C) 2007-2009 Cohesive Financial Technologies
49 // LLC. Portions created by Rabbit Technologies Ltd are Copyright
50 // (C) 2007-2009 Rabbit Technologies Ltd.
52 // All Rights Reserved.
54 // Contributor(s): ______________________________________.
56 //---------------------------------------------------------------------------
59 namespace RabbitMQ.Client
61 ///<summary>Information about the reason why a particular model,
62 ///session, or connection was destroyed.</summary>
64 ///The ClassId and Initiator properties should be
65 ///used to determine the originator of the shutdown event.
67 public class ShutdownEventArgs : EventArgs
69 private readonly ShutdownInitiator m_initiator;
70 private readonly ushort m_replyCode;
71 private readonly string m_replyText;
72 private readonly ushort m_classId;
73 private readonly ushort m_methodId;
74 private readonly object m_cause;
76 ///<summary>Returns the source of the shutdown event: either
77 ///the application, the library, or the remote peer.</summary>
78 public ShutdownInitiator Initiator { get { return m_initiator; } }
80 ///<summary>One of the standardised AMQP reason codes. See
81 ///RabbitMQ.Client.Framing.*.Constants.</summary>
82 public ushort ReplyCode { get { return m_replyCode; } }
84 ///<summary>Informative human-readable reason text.</summary>
85 public string ReplyText { get { return m_replyText; } }
87 ///<summary>AMQP content-class ID, or 0 if none.</summary>
88 public ushort ClassId { get { return m_classId; } }
90 ///<summary>AMQP method ID within a content-class, or 0 if none.</summary>
91 public ushort MethodId { get { return m_methodId; } }
93 ///<summary>Object causing the shutdown, or null if none.</summary>
94 public object Cause { get { return m_cause; } }
96 ///<summary>Construct a ShutdownEventArgs with the given
97 ///parameters, 0 for ClassId and MethodId, and a null
99 public ShutdownEventArgs(ShutdownInitiator initiator,
108 ///<summary>Construct a ShutdownEventArgs with the given
109 ///parameters and 0 for ClassId and MethodId.</summary>
110 public ShutdownEventArgs(ShutdownInitiator initiator,
122 ///<summary>Construct a ShutdownEventArgs with the given
123 ///parameters and a null cause.</summary>
124 public ShutdownEventArgs(ShutdownInitiator initiator,
137 ///<summary>Construct a ShutdownEventArgs with the given
138 ///parameters.</summary>
139 public ShutdownEventArgs(ShutdownInitiator initiator,
146 m_initiator = initiator;
147 m_replyCode = replyCode;
148 m_replyText = replyText;
150 m_methodId = methodId;
154 ///<summary>Override ToString to be useful for debugging.</summary>
155 public override string ToString()
157 return "AMQP close-reason, initiated by " + m_initiator +
158 ", code=" + m_replyCode +
159 ", text=\"" + m_replyText + "\"" +
160 ", classId=" + m_classId +
161 ", methodId=" + m_methodId +
162 ", cause=" + m_cause;