Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[watermill-amqp] Issue with exclusive or auto-delete queues after reconnection #315

Open
reva2 opened this issue Dec 2, 2022 · 1 comment · May be fixed by ThreeDotsLabs/watermill-amqp#17

Comments

@reva2
Copy link

reva2 commented Dec 2, 2022

Hi

It looks like current AMQP pub/sub implementation doesn't re-create queues after reconnection. It cause errors in case of "exclusive" or "auto-delete" queues in RabbitMQ:

cannot consume from channel: Exception (404) Reason: "NOT_FOUND - no queue 'macsvc_reva2.orbitsoft_5065325975852691651' in vhost '/'

Here example of configuration which cause problems:

conf := amqp.Config{
    Connection: amqp.ConnectionConfig{
        AmqpURI:   "amqp://user:password@127.0.0.1:5672/"
    },
    Marshaler: amqp.DefaultMarshaler{},
    Exchange: amqp.ExchangeConfig{
        GenerateName: func(topic string) string {
            return "test_exchange"
        },
        Type:    "fanout",
        Durable: false,
    },
    Queue: amqp.QueueConfig{
        GenerateName: func(topic string) string {
            hostname, err := os.Hostname()
            if err != nil {
                hostname = "unknown"
            }

            return "mysvc_" + hostname + "_" + strconv.Itoa(rand.Int())
        },
        Exclusive:  true,
    },
    QueueBind: amqp.QueueBindConfig{
        GenerateRoutingKey: func(topic string) string {
            return ""
        },
    },
    Publish: amqp.PublishConfig{
        GenerateRoutingKey: func(topic string) string {
            return topic
        },
    },
    Consume: amqp.ConsumeConfig{
        Qos: amqp.QosConfig{
            PrefetchCount: 5,
        },
    },
    TopologyBuilder: &amqp.DefaultTopologyBuilder{},
}
reva2 pushed a commit to reva2/watermill-amqp that referenced this issue Dec 2, 2022
@shaneing
Copy link

I opened a duplicated PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants