Skip to content

Commit e14662f

Browse files
author
Emile Joubert
committed
Revert bug23887
1 parent 9609592 commit e14662f

File tree

7 files changed

+20
-27
lines changed

7 files changed

+20
-27
lines changed

docs/RabbitMQ Service Model.doc

0 Bytes
Binary file not shown.

docs/RabbitMQ Service Model.docx

-102 Bytes
Binary file not shown.

docs/RabbitMQ Service Model.pdf

45.3 KB
Binary file not shown.

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -332,24 +332,5 @@ public AuthMechanismFactory AuthMechanismFactory(string[] mechs) {
332332

333333
return null;
334334
}
335-
336-
public static explicit operator ConnectionFactory(Uri uri)
337-
{
338-
ConnectionFactory connFactory = new ConnectionFactory();
339-
if (uri.UserInfo.Length > 0)
340-
{
341-
String[] userInfo = uri.UserInfo.Split(":".ToCharArray());
342-
connFactory.UserName = Uri.UnescapeDataString(userInfo[0]);
343-
if (userInfo.Length > 1)
344-
{
345-
connFactory.Password = Uri.UnescapeDataString(userInfo[1]);
346-
}
347-
}
348-
connFactory.VirtualHost = Uri.UnescapeDataString(uri.AbsolutePath.Remove(0, 1));
349-
connFactory.Port = uri.Port;
350-
connFactory.HostName = uri.Host;
351-
return connFactory;
352-
}
353-
354335
}
355336
}

projects/examples/wcf/Test/App.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
<rabbitMQBinding>
4444
<binding
4545
name="rabbitMQConfig"
46-
broker="amqp://localhost:5672/%2F"
46+
broker="amqp://localhost:5672/"
4747
protocolversion="AMQP_0_9_1" />
4848
</rabbitMQBinding>
4949
</bindings>
5050
</system.serviceModel>
5151

5252
<appSettings>
53-
<add key="manual-test-broker-uri" value="amqp://localhost:5672/%2F"/>
53+
<add key="manual-test-broker-uri" value="amqp://localhost:5672/"/>
5454
<add key="manual-test-broker-protocol" value="AMQP_0_9_1"/>
5555
</appSettings>
5656
</configuration>

projects/examples/wcf/configDemo/Server/App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<bindings>
2121
<rabbitMQBinding>
2222
<binding name="rabbitMQConfig"
23-
broker="amqp://localhost:5672/%2F"
23+
broker="amqp://localhost:5672/"
2424
protocolversion="AMQP_0_9_1"
2525
oneWay="false"/>
2626
</rabbitMQBinding>

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public sealed class RabbitMQTransportBindingElement : TransportBindingElement
5757
{
5858
private ConnectionFactory m_connectionFactory;
5959
private IConnection m_connection;
60+
private bool m_hasBroker = false;
6061

6162
/// <summary>
6263
/// Creates a new instance of the RabbitMQTransportBindingElement Class using the default protocol.
@@ -71,8 +72,8 @@ private RabbitMQTransportBindingElement(RabbitMQTransportBindingElement other)
7172
{
7273
Broker = other.Broker;
7374
BrokerProtocol = other.BrokerProtocol;
74-
m_connectionFactory = (ConnectionFactory) other.Broker;
7575
}
76+
7677

7778
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingContext context)
7879
{
@@ -154,18 +155,29 @@ public override string Scheme
154155
}
155156

156157

157-
private Uri m_broker;
158158
/// <summary>
159159
/// Specifies the address of the RabbitMQ Server
160160
/// </summary>
161161
[ConfigurationProperty("broker")]
162162
public Uri Broker
163163
{
164-
get { return m_broker; }
164+
get
165+
{
166+
if(!m_hasBroker) return null;
167+
UriBuilder build = new UriBuilder();
168+
build.Host = m_connectionFactory.HostName;
169+
build.Port = m_connectionFactory.Port;
170+
return build.Uri;
171+
}
165172
set
166173
{
167-
m_broker = value;
168-
m_connectionFactory = (ConnectionFactory) value;
174+
if(value == null) m_hasBroker = false;
175+
else
176+
{
177+
m_hasBroker = true;
178+
m_connectionFactory.HostName = value.Host;
179+
m_connectionFactory.Port = value.Port;
180+
}
169181
}
170182
}
171183

0 commit comments

Comments
 (0)