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, 2008 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 by LShift Ltd., Cohesive Financial Technologies
42 // LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007, 2008
43 // LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
46 // All Rights Reserved.
48 // Contributor(s): ______________________________________.
50 //---------------------------------------------------------------------------
53 namespace RabbitMQ.Client
55 ///<summary>Information about the reason why a particular model,
56 ///session, or connection was destroyed.</summary>
58 ///The ClassId and Initiator properties should be
59 ///used to determine the originator of the shutdown event.
61 public class ShutdownEventArgs : EventArgs
63 private readonly ShutdownInitiator m_initiator;
64 private readonly ushort m_replyCode;
65 private readonly string m_replyText;
66 private readonly ushort m_classId;
67 private readonly ushort m_methodId;
68 private readonly object m_cause;
70 ///<summary>Returns the source of the shutdown event: either
71 ///the application, the library, or the remote peer.</summary>
72 public ShutdownInitiator Initiator { get { return m_initiator; } }
74 ///<summary>One of the standardised AMQP reason codes. See
75 ///RabbitMQ.Client.Framing.*.Constants.</summary>
76 public ushort ReplyCode { get { return m_replyCode; } }
78 ///<summary>Informative human-readable reason text.</summary>
79 public string ReplyText { get { return m_replyText; } }
81 ///<summary>AMQP content-class ID, or 0 if none.</summary>
82 public ushort ClassId { get { return m_classId; } }
84 ///<summary>AMQP method ID within a content-class, or 0 if none.</summary>
85 public ushort MethodId { get { return m_methodId; } }
87 ///<summary>Object causing the shutdown, or null if none.</summary>
88 public object Cause { get { return m_cause; } }
90 ///<summary>Construct a ShutdownEventArgs with the given
91 ///parameters, 0 for ClassId and MethodId, and a null
93 public ShutdownEventArgs(ShutdownInitiator initiator,
102 ///<summary>Construct a ShutdownEventArgs with the given
103 ///parameters and 0 for ClassId and MethodId.</summary>
104 public ShutdownEventArgs(ShutdownInitiator initiator,
116 ///<summary>Construct a ShutdownEventArgs with the given
117 ///parameters and a null cause.</summary>
118 public ShutdownEventArgs(ShutdownInitiator initiator,
131 ///<summary>Construct a ShutdownEventArgs with the given
132 ///parameters.</summary>
133 public ShutdownEventArgs(ShutdownInitiator initiator,
140 m_initiator = initiator;
141 m_replyCode = replyCode;
142 m_replyText = replyText;
144 m_methodId = methodId;
148 ///<summary>Override ToString to be useful for debugging.</summary>
149 public override string ToString()
151 return "AMQP close-reason, initiated by " + m_initiator +
152 ", code=" + m_replyCode +
153 ", text=\"" + m_replyText + "\"" +
154 ", classId=" + m_classId +
155 ", methodId=" + m_methodId +
156 ", cause=" + m_cause;