@@ -9,10 +9,10 @@ type AMQPBindingInfo struct {
99}
1010
1111type AMQPBinding struct {
12- sourceExchangeName string
13- destinationQueue string
14- bindingKey string
15- management * AmqpManagement
12+ sourceExchange IExchangeSpecification
13+ destinationQueue IQueueSpecification
14+ bindingKey string
15+ management * AmqpManagement
1616}
1717
1818func newAMQPBinding (management * AmqpManagement ) * AMQPBinding {
@@ -24,13 +24,13 @@ func (b *AMQPBinding) Key(bindingKey string) IBindingSpecification {
2424 return b
2525}
2626
27- func (b * AMQPBinding ) SourceExchange (exchangeName string ) IBindingSpecification {
28- b .sourceExchangeName = exchangeName
27+ func (b * AMQPBinding ) SourceExchange (exchangeSpec IExchangeSpecification ) IBindingSpecification {
28+ b .sourceExchange = exchangeSpec
2929 return b
3030}
3131
32- func (b * AMQPBinding ) DestinationQueue (queueName string ) IBindingSpecification {
33- b .destinationQueue = queueName
32+ func (b * AMQPBinding ) DestinationQueue (queueSpec IQueueSpecification ) IBindingSpecification {
33+ b .destinationQueue = queueSpec
3434 return b
3535}
3636
@@ -39,16 +39,16 @@ func (b *AMQPBinding) Bind(ctx context.Context) error {
3939 path := bindingPath ()
4040 kv := make (map [string ]any )
4141 kv ["binding_key" ] = b .bindingKey
42- kv ["source" ] = b .sourceExchangeName
43- kv ["destination_queue" ] = b .destinationQueue
42+ kv ["source" ] = b .sourceExchange . GetName ()
43+ kv ["destination_queue" ] = b .destinationQueue . GetName ()
4444 kv ["arguments" ] = make (map [string ]any )
4545 _ , err := b .management .Request (ctx , kv , path , commandPost , []int {responseCode204 })
4646 return err
4747
4848}
4949
5050func (b * AMQPBinding ) Unbind (ctx context.Context ) error {
51- bindingPathWithExchangeQueueKey := bindingPathWithExchangeQueueKey (b .sourceExchangeName , b .destinationQueue , b .bindingKey )
51+ bindingPathWithExchangeQueueKey := bindingPathWithExchangeQueueKey (b .sourceExchange , b .destinationQueue , b .bindingKey )
5252 _ , err := b .management .Request (ctx , amqp.Null {}, bindingPathWithExchangeQueueKey , commandDelete , []int {responseCode204 })
5353 return err
5454}
0 commit comments