@@ -10,8 +10,8 @@ namespace RabbitMQ.AMQP.Client.Impl
1010{
1111 public abstract class BindingSpecification
1212 {
13- protected string _source = "" ;
14- protected string _destination = "" ;
13+ protected string _sourceName = "" ;
14+ protected string _destinationName = "" ;
1515 protected string _routingKey = "" ;
1616 protected bool _toQueue = true ;
1717 protected Dictionary < string , object > _arguments = new ( ) ;
@@ -41,21 +41,22 @@ public AmqpBindingSpecification(AmqpManagement management)
4141 _topologyListener = ( ( IManagementTopology ) _management ) . TopologyListener ( ) ;
4242 }
4343
44- public Dictionary < string , object > Arguments ( )
44+ public string BindingPath
4545 {
46- return _arguments ;
46+ get
47+ {
48+ return BindingsTarget ( ) ;
49+ }
4750 }
4851
49- public string Path ( ) => BindingsTarget ( ) ;
50-
5152 public async Task BindAsync ( )
5253 {
5354 var kv = new Map
5455 {
55- { "source" , _source } ,
56+ { "source" , _sourceName } ,
5657 { "binding_key" , _routingKey } ,
5758 { "arguments" , ArgsToMap ( ) } ,
58- { _toQueue ? "destination_queue" : "destination_exchange" , _destination }
59+ { _toQueue ? "destination_queue" : "destination_exchange" , _destinationName }
5960 } ;
6061
6162 string path = $ "/{ Consts . Bindings } ";
@@ -78,9 +79,9 @@ public async Task UnbindAsync()
7879 if ( _arguments . Count == 0 )
7980 {
8081 string path =
81- $ "/{ Consts . Bindings } /src={ Utils . EncodePathSegment ( _source ) } ;{ ( $ "{ destinationCharacter } ={ Utils . EncodePathSegment ( _destination ) } ;key={ Utils . EncodePathSegment ( _routingKey ) } ;args=") } ";
82+ $ "/{ Consts . Bindings } /src={ Utils . EncodePathSegment ( _sourceName ) } ;{ ( $ "{ destinationCharacter } ={ Utils . EncodePathSegment ( _destinationName ) } ;key={ Utils . EncodePathSegment ( _routingKey ) } ;args=") } ";
8283
83- _topologyListener . BindingDeleted ( Path ( ) ) ;
84+ _topologyListener . BindingDeleted ( BindingPath ) ;
8485 await _management . RequestAsync ( null , path , method , expectedReturnCodes )
8586 . ConfigureAwait ( false ) ;
8687 }
@@ -104,55 +105,76 @@ await _management.RequestAsync(null, path, method, expectedReturnCodes)
104105
105106 public IBindingSpecification SourceExchange ( IExchangeSpecification exchangeSpec )
106107 {
107- return SourceExchange ( exchangeSpec . Name ( ) ) ;
108+ return SourceExchange ( exchangeSpec . ExchangeName ) ;
108109 }
109110
110111 public IBindingSpecification SourceExchange ( string exchangeName )
111112 {
112113 _toQueue = false ;
113- _source = exchangeName ;
114+ _sourceName = exchangeName ;
114115 return this ;
115116 }
116117
117- public string SourceExchangeName ( )
118+ public string SourceExchangeName
118119 {
119- return _source ;
120+ get
121+ {
122+ return _sourceName ;
123+ }
120124 }
121125
122126 public IBindingSpecification DestinationQueue ( IQueueSpecification queueSpec )
123127 {
124- return DestinationQueue ( queueSpec . Name ( ) ) ;
128+ return DestinationQueue ( queueSpec . QueueName ) ;
125129 }
126130
127131 public IBindingSpecification DestinationQueue ( string queueName )
128132 {
129133 _toQueue = true ;
130- _destination = queueName ;
134+ _destinationName = queueName ;
131135 return this ;
132136 }
133137
134- public string DestinationQueueName ( ) => _destination ;
138+ public string DestinationQueueName
139+ {
140+ get
141+ {
142+ return _destinationName ;
143+ }
144+ }
135145
136146 public IBindingSpecification DestinationExchange ( IExchangeSpecification exchangeSpec )
137147 {
138- return DestinationExchange ( exchangeSpec . Name ( ) ) ;
148+ return DestinationExchange ( exchangeSpec . ExchangeName ) ;
139149 }
140150
141151 public IBindingSpecification DestinationExchange ( string exchangeName )
142152 {
143- _destination = exchangeName ;
153+ _destinationName = exchangeName ;
144154 return this ;
145155 }
146156
147- public string DestinationExchangeName ( ) => _destination ;
157+ public string DestinationExchangeName
158+ {
159+ get
160+ {
161+ return _destinationName ;
162+ }
163+ }
148164
149- public IBindingSpecification Key ( string key )
165+ public IBindingSpecification Key ( string bindingKey )
150166 {
151- _routingKey = key ;
167+ _routingKey = bindingKey ;
152168 return this ;
153169 }
154170
155- public string Key ( ) => _routingKey ;
171+ public string BindingKey
172+ {
173+ get
174+ {
175+ return _routingKey ;
176+ }
177+ }
156178
157179 public IBindingSpecification Argument ( string key , object value )
158180 {
@@ -166,15 +188,23 @@ public IBindingSpecification Arguments(Dictionary<string, object> arguments)
166188 return this ;
167189 }
168190
191+ public Dictionary < string , object > BindingArguments
192+ {
193+ get
194+ {
195+ return _arguments ;
196+ }
197+ }
198+
169199 private string BindingsTarget ( )
170200 {
171201 string destinationField = _toQueue ? "dstq" : "dste" ;
172202 return "/bindings?src="
173- + Utils . EncodeHttpParameter ( _source )
203+ + Utils . EncodeHttpParameter ( _sourceName )
174204 + "&"
175205 + destinationField
176206 + "="
177- + Utils . EncodeHttpParameter ( _destination )
207+ + Utils . EncodeHttpParameter ( _destinationName )
178208 + "&key="
179209 + Utils . EncodeHttpParameter ( _routingKey ) ;
180210 }
0 commit comments