Foo-Foo-MQ / foo-foo-mq

Abstractions around RabbitMQ
MIT License
48 stars 24 forks source link

Unknown multiple queues created in the RabbitMQ server #20

Closed vsalvans closed 3 years ago

vsalvans commented 3 years ago

I'm using this library to publish messages when some AWS S3 upload events happen. It seem that when I upload a lot of images I've got these queues in the RabbitMQ server

image

This is the code I use:

rabbit.configure({
        connection: {
          name: 'default',
          user: AMQP_USER,
          pass: AMQP_PWD,
          host: AMQP_HOST,
          port: 5672,
          vhost: '%2f',
        },
        exchanges: [
            { name: 'amq.topic', type: 'topic', durable: true }
        ],
    });

rabbit.publish(
        'amq.topic',
        {
            type,
            body: payload,
            headers: {
                name: type,
                from: 's3'
            },
            timeout: 1000,

        },
    )

Where the variable type is 'event.image.created'

Can someone explain me what could be the reason?

Thanks!

zlintz commented 3 years ago

@vsalvans Checkout https://github.com/Foo-Foo-MQ/foo-foo-mq/blob/master/docs/receiving.md#reply-queues for details about these response queues. If you do not need replyQueue functionality, you can shut it off as described in the doc.

That said, I was unable to reproduce what you are experiencing using the details provided.

Are you also running multiple processes? or servers? containers?

From the looks of the screen shot, it seems like you have multiple machines running and all running on PID 7 or 8 and still have an active connection. When the connection closes, these should auto-delete by rabbitmq as denoted by the blue AD in the "Features" column

vsalvans commented 3 years ago

Thanks @zlintz !!

I'll use:

rabbit.configure( {
  // ...
  replyQueue: false
} );

The code runs in a AWS Lambda function that is triggered when an image is uploaded to in a S3 Bucket. This functions not only publish a message but it does some other stuff. I don't know the architecture thats behind scenes of AWS Lambda functions. But it's true this code is run by different servers because each queue name starts with a different ip address. I cut them out from the picture.

I don't know why these queues are not auto-deleted. I've noticed they stay only when lots of images (let's say 300) are uploaded then lots of connections and messages are published in a short time.