@@ -73,14 +73,6 @@ namespace RabbitMQ.Client
73
73
///</para>
74
74
public class AmqpTcpEndpoint
75
75
{
76
- private IProtocol m_protocol ;
77
- ///<summary>Retrieve or set the IProtocol of this AmqpTcpEndpoint.</summary>
78
- public IProtocol Protocol
79
- {
80
- get { return m_protocol ; }
81
- set { m_protocol = value ; }
82
- }
83
-
84
76
private string m_hostName ;
85
77
///<summary>Retrieve or set the hostname of this AmqpTcpEndpoint.</summary>
86
78
public string HostName
@@ -91,11 +83,11 @@ public string HostName
91
83
92
84
private int m_port ;
93
85
///<summary>Retrieve or set the port number of this
94
- ///AmqpTcpEndpoint. A port number of -1 causes the default
95
- ///port number for the IProtocol to be used. </summary>
86
+ ///AmqpTcpEndpoint. -1 indicates the default value should be used.
87
+ ///</summary>
96
88
public int Port
97
89
{
98
- get { return ( m_port == - 1 ) ? m_protocol . DefaultPort : m_port ; }
90
+ get { return m_port ; }
99
91
set { m_port = value ; }
100
92
}
101
93
@@ -110,67 +102,37 @@ public SslOption Ssl
110
102
}
111
103
112
104
///<summary>Construct an AmqpTcpEndpoint with the given
113
- ///IProtocol, hostname, port number and ssl option. If the port
105
+ ///hostname, port number and ssl option. If the port
114
106
///number is -1, the default port number for the IProtocol
115
107
///will be used.</summary>
116
- public AmqpTcpEndpoint ( IProtocol protocol , string hostName , int portOrMinusOne , SslOption ssl )
108
+ public AmqpTcpEndpoint ( string hostName , int portOrMinusOne , SslOption ssl )
117
109
{
118
- m_protocol = protocol ;
119
110
m_hostName = hostName ;
120
111
m_port = portOrMinusOne ;
121
112
m_ssl = ssl ;
122
113
}
123
114
124
115
///<summary>Construct an AmqpTcpEndpoint with the given
125
- ///IProtocol, hostname, and port number. If the port number is
126
- ///-1, the default port number for the IProtocol will be
127
- ///used.</summary>
128
- public AmqpTcpEndpoint ( IProtocol protocol , string hostName , int portOrMinusOne ) :
129
- this ( protocol , hostName , portOrMinusOne , new SslOption ( ) )
130
- {
131
- }
132
-
133
- ///<summary>Construct an AmqpTcpEndpoint with the given
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
116
+ /// hostname, and port number. If the port number is
152
117
///-1, the default port number for the IProtocol will be
153
118
///used.</summary>
154
119
public AmqpTcpEndpoint ( string hostName , int portOrMinusOne ) :
155
- this ( Protocols . FromEnvironment ( ) , hostName , portOrMinusOne )
120
+ this ( hostName , portOrMinusOne , new SslOption ( ) )
156
121
{
157
122
}
158
123
159
124
///<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>
125
+ ///hostname, using the default port for the
126
+ ///IProtocol.</summary>
163
127
public AmqpTcpEndpoint ( string hostName ) :
164
- this ( Protocols . FromEnvironment ( ) , hostName )
128
+ this ( hostName , - 1 )
165
129
{
166
130
}
167
131
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>
132
+ ///<summary>Construct an AmqpTcpEndpoint with the given
133
+ ///localhost" as the hostname, and the default port </summary>
172
134
public AmqpTcpEndpoint ( ) :
173
- this ( Protocols . FromEnvironment ( ) )
135
+ this ( "localhost" , - 1 )
174
136
{
175
137
}
176
138
@@ -180,31 +142,19 @@ public AmqpTcpEndpoint() :
180
142
/// Please see the class overview documentation for
181
143
/// information about the Uri format in use.
182
144
///</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 )
145
+ public AmqpTcpEndpoint ( Uri uri , SslOption ssl ) :
146
+ this ( uri . Host , uri . Port , ssl )
196
147
{
197
148
}
198
149
199
150
///<summary>Construct an AmqpTcpEndpoint with the given
200
- ///Uri, using the IProtocol from
201
- ///Protocols.FromEnvironment().</summary>
151
+ ///Uri.</summary>
202
152
///<remarks>
203
153
/// Please see the class overview documentation for
204
154
/// information about the Uri format in use.
205
155
///</remarks>
206
156
public AmqpTcpEndpoint ( Uri uri ) :
207
- this ( Protocols . FromEnvironment ( ) , uri )
157
+ this ( uri . Host , uri . Port )
208
158
{
209
159
}
210
160
@@ -215,7 +165,7 @@ public AmqpTcpEndpoint(Uri uri) :
215
165
///</remarks>
216
166
public override string ToString ( )
217
167
{
218
- return "amqp-" + Protocol + " ://" + HostName + ":" + Port ;
168
+ return "amqp://" + HostName + ":" + Port ;
219
169
}
220
170
221
171
///<summary>Compares this instance by value (protocol,
@@ -224,24 +174,22 @@ public override bool Equals(object obj)
224
174
{
225
175
AmqpTcpEndpoint other = obj as AmqpTcpEndpoint ;
226
176
if ( other == null ) return false ;
227
- if ( other . Protocol != Protocol ) return false ;
228
177
if ( other . HostName != HostName ) return false ;
229
178
if ( other . Port != Port ) return false ;
230
179
return true ;
231
180
}
232
181
233
- ///<summary>Implementation of hash code depending on protocol,
182
+ ///<summary>Implementation of hash code depending on
234
183
///hostname and port, to line up with the implementation of
235
184
///Equals()</summary>
236
185
public override int GetHashCode ( )
237
186
{
238
187
return
239
- Protocol . GetHashCode ( ) ^
240
188
HostName . GetHashCode ( ) ^
241
189
Port ;
242
190
}
243
191
244
- ///<summary>Construct an instance from a protocol and an
192
+ ///<summary>Construct an instance from an
245
193
///address in "hostname:port" format.</summary>
246
194
///<remarks>
247
195
/// If the address string passed in contains ":", it is split
@@ -250,15 +198,14 @@ public override int GetHashCode()
250
198
/// is set to -1 (meaning the default number for the protocol
251
199
/// variant specified).
252
200
///</remarks>
253
- public static AmqpTcpEndpoint Parse ( IProtocol protocol , string address ) {
201
+ public static AmqpTcpEndpoint Parse ( string address ) {
254
202
int index = address . IndexOf ( ':' ) ;
255
203
if ( index == - 1 ) {
256
- return new AmqpTcpEndpoint ( protocol , address , - 1 ) ;
204
+ return new AmqpTcpEndpoint ( address , - 1 ) ;
257
205
} else {
258
206
string portStr = address . Substring ( index + 1 ) . Trim ( ) ;
259
207
int portNum = ( portStr . Length == 0 ) ? - 1 : int . Parse ( portStr ) ;
260
- return new AmqpTcpEndpoint ( protocol ,
261
- address . Substring ( 0 , index ) ,
208
+ return new AmqpTcpEndpoint ( address . Substring ( 0 , index ) ,
262
209
portNum ) ;
263
210
}
264
211
}
@@ -271,13 +218,13 @@ public static AmqpTcpEndpoint Parse(IProtocol protocol, string address) {
271
218
/// optional, and returns a corresponding array of
272
219
/// AmqpTcpEndpoints.
273
220
///</remarks>
274
- public static AmqpTcpEndpoint [ ] ParseMultiple ( IProtocol protocol , string addresses ) {
221
+ public static AmqpTcpEndpoint [ ] ParseMultiple ( string addresses ) {
275
222
string [ ] partsArr = addresses . Split ( new char [ ] { ',' } ) ;
276
223
ArrayList results = new ArrayList ( ) ;
277
224
foreach ( string partRaw in partsArr ) {
278
225
string part = partRaw . Trim ( ) ;
279
226
if ( part . Length > 0 ) {
280
- results . Add ( Parse ( protocol , part ) ) ;
227
+ results . Add ( Parse ( part ) ) ;
281
228
}
282
229
}
283
230
return ( AmqpTcpEndpoint [ ] ) results . ToArray ( typeof ( AmqpTcpEndpoint ) ) ;
0 commit comments