Skip to content

Commit 0a737ae

Browse files
Use default IProtocol (0-9-1) in more places
1 parent 935a68b commit 0a737ae

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

projects/client/RabbitMQ.Client/src/client/api/AmqpTcpEndpoint.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,30 +142,29 @@ public AmqpTcpEndpoint(IProtocol protocol) :
142142
}
143143

144144
///<summary>Construct an AmqpTcpEndpoint with the given
145-
///hostname and port number, using the IProtocol from
146-
///Protocols.FromEnvironment(). If the port number is
145+
///hostname and port number, using Protocols.DefaultProtocol. If the port number is
147146
///-1, the default port number for the IProtocol will be
148147
///used.</summary>
149148
public AmqpTcpEndpoint(string hostName, int portOrMinusOne) :
150-
this(Protocols.FromEnvironment(), hostName, portOrMinusOne)
149+
this(Protocols.DefaultProtocol, hostName, portOrMinusOne)
151150
{
152151
}
153152

154153
///<summary>Construct an AmqpTcpEndpoint with the given
155154
///hostname, using the IProtocol from
156-
///Protocols.FromEnvironment(), and the default port number of
155+
///Protocols.DefaultProtocol, and the default port number of
157156
///that IProtocol.</summary>
158157
public AmqpTcpEndpoint(string hostName) :
159-
this(Protocols.FromEnvironment(), hostName)
158+
this(Protocols.DefaultProtocol, hostName)
160159
{
161160
}
162161

163162
///<summary>Construct an AmqpTcpEndpoint with a hostname of
164163
///"localhost", using the IProtocol from
165-
///Protocols.FromEnvironment(), and the default port number of
164+
///Protocols.DefaultProtocol, and the default port number of
166165
///that IProtocol.</summary>
167166
public AmqpTcpEndpoint() :
168-
this(Protocols.FromEnvironment())
167+
this(Protocols.DefaultProtocol)
169168
{
170169
}
171170

@@ -193,13 +192,13 @@ public AmqpTcpEndpoint(IProtocol protocol, Uri uri) :
193192

194193
///<summary>Construct an AmqpTcpEndpoint with the given
195194
///Uri, using the IProtocol from
196-
///Protocols.FromEnvironment().</summary>
195+
///Protocols.DefaultProtocol.</summary>
197196
///<remarks>
198197
/// Please see the class overview documentation for
199198
/// information about the Uri format in use.
200199
///</remarks>
201200
public AmqpTcpEndpoint(Uri uri) :
202-
this(Protocols.FromEnvironment(), uri)
201+
this(Protocols.DefaultProtocol, uri)
203202
{
204203
}
205204

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ namespace RabbitMQ.Client
6363
/// factory.UserName = ConnectionFactory.DefaultUser;
6464
/// factory.Password = ConnectionFactory.DefaultPass;
6565
/// factory.VirtualHost = ConnectionFactory.DefaultVHost;
66-
/// factory.Protocol = Protocols.FromEnvironment();
6766
/// factory.HostName = hostName;
6867
/// factory.Port = AmqpTcpEndpoint.UseDefaultPort;
6968
/// //
@@ -165,8 +164,8 @@ public class ConnectionFactory
165164
///<summary> SASL auth mechanisms to use.</summary>
166165
public AuthMechanismFactory[] AuthMechanisms = DefaultAuthMechanisms;
167166

168-
///<summary>The AMQP protocol to be used</summary>
169-
public IProtocol Protocol = Protocols.FromEnvironment();
167+
///<summary>The AMQP protocol to be used. Currently 0-9-1.</summary>
168+
public IProtocol Protocol = Protocols.DefaultProtocol;
170169

171170
///<summary>The AMQP connection target</summary>
172171
public AmqpTcpEndpoint Endpoint

projects/examples/wcf/Test/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static Binding GetBinding() {
5656

5757
return new RabbitMQBinding(System.Configuration.ConfigurationManager.AppSettings["manual-test-broker-hostname"],
5858
int.Parse(System.Configuration.ConfigurationManager.AppSettings["manual-test-broker-port"]),
59-
RabbitMQ.Client.Protocols.FromConfiguration("manual-test-broker-protocol"));
59+
RabbitMQ.Client.Protocols.DefaultProtocol);
6060
}
6161

6262
static void Main(string[] args)

projects/wcf/RabbitMQ.ServiceModel/src/serviceModel/RabbitMQBindingConfigurationElement.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,7 @@ public long MaxMessageSize
204204
}
205205

206206
private IProtocol GetProtocol() {
207-
IProtocol result = Protocols.Lookup(this.ProtocolVersion);
208-
if (result == null) {
209-
throw new ConfigurationErrorsException(string.Format("'{0}' is not a valid AMQP protocol name",
210-
this.ProtocolVersion));
211-
}
212-
return result;
207+
return Protocols.DefaultProtocol;
213208
}
214209

215210
/// <summary>

0 commit comments

Comments
 (0)