File tree Expand file tree Collapse file tree 7 files changed +20
-27
lines changed
client/RabbitMQ.Client/src/client/api
wcf/RabbitMQ.ServiceModel/src/serviceModel Expand file tree Collapse file tree 7 files changed +20
-27
lines changed Original file line number Diff line number Diff line change @@ -332,24 +332,5 @@ public AuthMechanismFactory AuthMechanismFactory(string[] mechs) {
332
332
333
333
return null ;
334
334
}
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
-
354
335
}
355
336
}
Original file line number Diff line number Diff line change 43
43
<rabbitMQBinding >
44
44
<binding
45
45
name =" rabbitMQConfig"
46
- broker =" amqp://localhost:5672/%2F "
46
+ broker =" amqp://localhost:5672/"
47
47
protocolversion =" AMQP_0_9_1" />
48
48
</rabbitMQBinding >
49
49
</bindings >
50
50
</system .serviceModel>
51
51
52
52
<appSettings >
53
- <add key =" manual-test-broker-uri" value =" amqp://localhost:5672/%2F " />
53
+ <add key =" manual-test-broker-uri" value =" amqp://localhost:5672/" />
54
54
<add key =" manual-test-broker-protocol" value =" AMQP_0_9_1" />
55
55
</appSettings >
56
56
</configuration >
Original file line number Diff line number Diff line change 20
20
<bindings >
21
21
<rabbitMQBinding >
22
22
<binding name =" rabbitMQConfig"
23
- broker =" amqp://localhost:5672/%2F "
23
+ broker =" amqp://localhost:5672/"
24
24
protocolversion =" AMQP_0_9_1"
25
25
oneWay =" false" />
26
26
</rabbitMQBinding >
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ public sealed class RabbitMQTransportBindingElement : TransportBindingElement
57
57
{
58
58
private ConnectionFactory m_connectionFactory ;
59
59
private IConnection m_connection ;
60
+ private bool m_hasBroker = false ;
60
61
61
62
/// <summary>
62
63
/// Creates a new instance of the RabbitMQTransportBindingElement Class using the default protocol.
@@ -71,8 +72,8 @@ private RabbitMQTransportBindingElement(RabbitMQTransportBindingElement other)
71
72
{
72
73
Broker = other . Broker ;
73
74
BrokerProtocol = other . BrokerProtocol ;
74
- m_connectionFactory = ( ConnectionFactory ) other . Broker ;
75
75
}
76
+
76
77
77
78
public override IChannelFactory < TChannel > BuildChannelFactory < TChannel > ( BindingContext context )
78
79
{
@@ -154,18 +155,29 @@ public override string Scheme
154
155
}
155
156
156
157
157
- private Uri m_broker ;
158
158
/// <summary>
159
159
/// Specifies the address of the RabbitMQ Server
160
160
/// </summary>
161
161
[ ConfigurationProperty ( "broker" ) ]
162
162
public Uri Broker
163
163
{
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
+ }
165
172
set
166
173
{
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
+ }
169
181
}
170
182
}
171
183
You can’t perform that action at this time.
0 commit comments