@@ -63,6 +63,14 @@ namespace RabbitMQ.Client
63
63
///<summary>Represents a TCP-addressable AMQP peer, including the
64
64
///protocol variant to use, and a host name and port
65
65
///number.</summary>
66
+ ///<para>
67
+ /// Some of the constructors take, as a convenience, a System.Uri
68
+ /// instance representing an AMQP server address. The use of Uri
69
+ /// here is not standardised - Uri is simply a convenient
70
+ /// container for internet-address-like components. In particular,
71
+ /// the Uri "Scheme" property is ignored: only the "Host" and
72
+ /// "Port" properties are extracted.
73
+ ///</para>
66
74
public class AmqpTcpEndpoint
67
75
{
68
76
private IProtocol m_protocol ;
@@ -101,25 +109,103 @@ public SslOption Ssl
101
109
set { m_ssl = value ; }
102
110
}
103
111
112
+ ///<summary>Construct an AmqpTcpEndpoint with the given
113
+ ///IProtocol, hostname, port number and ssl option. If the port
114
+ ///number is -1, the default port number for the IProtocol
115
+ ///will be used.</summary>
116
+ public AmqpTcpEndpoint ( IProtocol protocol , string hostName , int portOrMinusOne , SslOption ssl )
117
+ {
118
+ m_protocol = protocol ;
119
+ m_hostName = hostName ;
120
+ m_port = portOrMinusOne ;
121
+ m_ssl = ssl ;
122
+ }
123
+
104
124
///<summary>Construct an AmqpTcpEndpoint with the given
105
125
///IProtocol, hostname, and port number. If the port number is
106
126
///-1, the default port number for the IProtocol will be
107
127
///used.</summary>
108
- public AmqpTcpEndpoint ( IProtocol protocolVariant , string hostname , int portOrMinusOne ) :
109
- this ( protocolVariant , hostname , portOrMinusOne , new SslOption ( ) )
128
+ public AmqpTcpEndpoint ( IProtocol protocol , string hostName , int portOrMinusOne ) :
129
+ this ( protocol , hostName , portOrMinusOne , new SslOption ( ) )
110
130
{
111
131
}
112
132
113
133
///<summary>Construct an AmqpTcpEndpoint with the given
114
- ///IProtocol, hostname, port number and Ssl option. If the port
115
- ///number is -1, the default port number for the IProtocol
116
- ///will be used.</summary>
117
- public AmqpTcpEndpoint ( IProtocol protocolVariant , string hostname , int portOrMinusOne , SslOption ssl )
134
+ ///IProtocol and hostname, using the default port for the
135
+ ///IProtocol.</summary>
136
+ public AmqpTcpEndpoint ( IProtocol protocol , string hostName ) :
137
+ this ( protocol , hostName , - 1 )
138
+ {
139
+ }
140
+
141
+ ///<summary>Construct an AmqpTcpEndpoint with the given
142
+ ///IProtocol, "localhost" as the hostname, and using the
143
+ ///default port for the IProtocol.</summary>
144
+ public AmqpTcpEndpoint ( IProtocol protocol ) :
145
+ this ( protocol , "localhost" , - 1 )
146
+ {
147
+ }
148
+
149
+ ///<summary>Construct an AmqpTcpEndpoint with the given
150
+ ///hostname and port number, using the IProtocol from
151
+ ///Protocols.FromEnvironment(). If the port number is
152
+ ///-1, the default port number for the IProtocol will be
153
+ ///used.</summary>
154
+ public AmqpTcpEndpoint ( string hostName , int portOrMinusOne ) :
155
+ this ( Protocols . FromEnvironment ( ) , hostName , portOrMinusOne )
156
+ {
157
+ }
158
+
159
+ ///<summary>Construct an AmqpTcpEndpoint with the given
160
+ ///hostname, using the IProtocol from
161
+ ///Protocols.FromEnvironment(), and the default port number of
162
+ ///that IProtocol.</summary>
163
+ public AmqpTcpEndpoint ( string hostName ) :
164
+ this ( Protocols . FromEnvironment ( ) , hostName )
165
+ {
166
+ }
167
+
168
+ ///<summary>Construct an AmqpTcpEndpoint with a hostname of
169
+ ///"localhost", using the IProtocol from
170
+ ///Protocols.FromEnvironment(), and the default port number of
171
+ ///that IProtocol.</summary>
172
+ public AmqpTcpEndpoint ( ) :
173
+ this ( Protocols . FromEnvironment ( ) )
174
+ {
175
+ }
176
+
177
+ ///<summary>Construct an AmqpTcpEndpoint with the given
178
+ ///IProtocol, Uri and ssl options.</summary>
179
+ ///<remarks>
180
+ /// Please see the class overview documentation for
181
+ /// information about the Uri format in use.
182
+ ///</remarks>
183
+ public AmqpTcpEndpoint ( IProtocol protocol , Uri uri , SslOption ssl ) :
184
+ this ( protocol , uri . Host , uri . Port , ssl )
185
+ {
186
+ }
187
+
188
+ ///<summary>Construct an AmqpTcpEndpoint with the given
189
+ ///IProtocol and Uri.</summary>
190
+ ///<remarks>
191
+ /// Please see the class overview documentation for
192
+ /// information about the Uri format in use.
193
+ ///</remarks>
194
+ public AmqpTcpEndpoint ( IProtocol protocol , Uri uri ) :
195
+ this ( protocol , uri . Host , uri . Port )
196
+ {
197
+ }
198
+
199
+ ///<summary>Construct an AmqpTcpEndpoint with the given
200
+ ///Uri, using the IProtocol from
201
+ ///Protocols.FromEnvironment().</summary>
202
+ ///<remarks>
203
+ /// Please see the class overview documentation for
204
+ /// information about the Uri format in use.
205
+ ///</remarks>
206
+ public AmqpTcpEndpoint ( Uri uri ) :
207
+ this ( Protocols . FromEnvironment ( ) , uri )
118
208
{
119
- m_protocol = protocolVariant ;
120
- m_hostName = hostname ;
121
- m_port = portOrMinusOne ;
122
- m_ssl = ssl ;
123
209
}
124
210
125
211
///<summary>Returns a URI-like string of the form
0 commit comments