Skip to content

Commit 3704acb

Browse files
use QueueDeclarePassive (#1209)
Co-authored-by: Iiqbal2000 <[email protected]>
1 parent 7031a4e commit 3704acb

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

pkg/adapter/adapter.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,14 @@ func (a *Adapter) PollForMessages(stopCh <-chan struct{}) error {
159159

160160
for {
161161
if channel := a.rmqHelper.GetChannel(); channel != nil {
162-
if queue, err = channel.QueueInspect(a.config.QueueName); err == nil {
162+
if queue, err = channel.QueueDeclarePassive(
163+
a.config.QueueName,
164+
true,
165+
false,
166+
false,
167+
false,
168+
amqp.Table{},
169+
); err == nil {
163170
connNotifyChannel, chNotifyChannel := a.rmqHelper.GetConnection().NotifyClose(make(chan *amqp.Error)), channel.NotifyClose(make(chan *amqp.Error))
164171
if msgs, err = a.ConsumeMessages(&queue, channel, logger); err == nil {
165172
loop:

pkg/rabbit/connections_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type RabbitMQChannelInterface interface {
5151
Confirm(bool) error
5252
Consume(string, string, bool, bool, bool, bool, amqp091.Table) (<-chan amqp091.Delivery, error)
5353
PublishWithDeferredConfirm(string, string, bool, bool, amqp091.Publishing) (*amqp091.DeferredConfirmation, error)
54-
QueueInspect(string) (amqp091.Queue, error)
54+
QueueDeclarePassive(string, bool, bool, bool, bool, amqp091.Table) (amqp091.Queue, error)
5555
}
5656

5757
type RabbitMQConnectionHandler struct {

pkg/rabbit/connections_handler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func Test_InvalidSetupRabbitMQ(t *testing.T) {
6666
t.Errorf("unexpected closed connection error")
6767
}
6868

69-
if _, err := rabbitMQHelper.Channel.QueueInspect("test"); err != nil {
69+
if _, err := rabbitMQHelper.Channel.QueueDeclarePassive("test", true, true, true, true, amqp091.Table{}); err != nil {
7070
t.Errorf("unexpected queue inspect error")
7171
}
7272

pkg/rabbit/rabbit_mocks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (rm *RabbitMQChannelMock) Confirm(a bool) error {
8686
return nil
8787
}
8888

89-
func (rm *RabbitMQChannelMock) QueueInspect(string) (amqp.Queue, error) {
89+
func (rm *RabbitMQChannelMock) QueueDeclarePassive(name string, durable, autoDelete, exclusive, noWait bool, args amqp.Table) (amqp.Queue, error) {
9090
return amqp.Queue{}, nil
9191
}
9292

0 commit comments

Comments
 (0)