@@ -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 ;
@@ -95,13 +103,80 @@ public int Port
95
103
///IProtocol, hostname, and port number. If the port number is
96
104
///-1, the default port number for the IProtocol will be
97
105
///used.</summary>
98
- public AmqpTcpEndpoint ( IProtocol protocolVariant , string hostname , int portOrMinusOne )
106
+ public AmqpTcpEndpoint ( IProtocol protocol , string hostName , int portOrMinusOne )
99
107
{
100
- m_protocol = protocolVariant ;
101
- m_hostName = hostname ;
108
+ m_protocol = protocol ;
109
+ m_hostName = hostName ;
102
110
m_port = portOrMinusOne ;
103
111
}
104
112
113
+ ///<summary>Construct an AmqpTcpEndpoint with the given
114
+ ///IProtocol and hostname, using the default port for the
115
+ ///IProtocol.</summary>
116
+ public AmqpTcpEndpoint ( IProtocol protocol , string hostName ) :
117
+ this ( protocol , hostName , - 1 )
118
+ {
119
+ }
120
+
121
+ ///<summary>Construct an AmqpTcpEndpoint with the given
122
+ ///IProtocol, "localhost" as the hostname, and using the
123
+ ///default port for the IProtocol.</summary>
124
+ public AmqpTcpEndpoint ( IProtocol protocol ) :
125
+ this ( protocol , "localhost" , - 1 )
126
+ {
127
+ }
128
+
129
+ ///<summary>Construct an AmqpTcpEndpoint with the given
130
+ ///hostname and port number, using the IProtocol from
131
+ ///Protocols.FromEnvironment(). If the port number is
132
+ ///-1, the default port number for the IProtocol will be
133
+ ///used.</summary>
134
+ public AmqpTcpEndpoint ( string hostName , int portOrMinusOne ) :
135
+ this ( Protocols . FromEnvironment ( ) , hostName , portOrMinusOne )
136
+ {
137
+ }
138
+
139
+ ///<summary>Construct an AmqpTcpEndpoint with the given
140
+ ///hostname, using the IProtocol from
141
+ ///Protocols.FromEnvironment(), and the default port number of
142
+ ///that IProtocol.</summary>
143
+ public AmqpTcpEndpoint ( string hostName ) :
144
+ this ( Protocols . FromEnvironment ( ) , hostName )
145
+ {
146
+ }
147
+
148
+ ///<summary>Construct an AmqpTcpEndpoint with a hostname of
149
+ ///"localhost", using the IProtocol from
150
+ ///Protocols.FromEnvironment(), and the default port number of
151
+ ///that IProtocol.</summary>
152
+ public AmqpTcpEndpoint ( ) :
153
+ this ( Protocols . FromEnvironment ( ) )
154
+ {
155
+ }
156
+
157
+ ///<summary>Construct an AmqpTcpEndpoint with the given
158
+ ///IProtocol and Uri.</summary>
159
+ ///<remarks>
160
+ /// Please see the class overview documentation for
161
+ /// information about the Uri format in use.
162
+ ///</remarks>
163
+ public AmqpTcpEndpoint ( IProtocol protocol , Uri uri ) :
164
+ this ( protocol , uri . Host , uri . Port )
165
+ {
166
+ }
167
+
168
+ ///<summary>Construct an AmqpTcpEndpoint with the given
169
+ ///Uri, using the IProtocol from
170
+ ///Protocols.FromEnvironment().</summary>
171
+ ///<remarks>
172
+ /// Please see the class overview documentation for
173
+ /// information about the Uri format in use.
174
+ ///</remarks>
175
+ public AmqpTcpEndpoint ( Uri uri ) :
176
+ this ( Protocols . FromEnvironment ( ) , uri )
177
+ {
178
+ }
179
+
105
180
///<summary>Returns a URI-like string of the form
106
181
///amqp-PROTOCOL://HOSTNAME:PORTNUMBER</summary>
107
182
///<remarks>
0 commit comments