wagslane / go-rabbitmq

A wrapper of streadway/amqp that provides reconnection logic and sane defaults
https://blog.boot.dev/golang/connecting-to-rabbitmq-in-golang-easy/
MIT License
772 stars 126 forks source link

WithPublisherOptionsReconnectInterval is a ConsumerOption. How to use it? #75

Closed willthrom closed 1 year ago

willthrom commented 2 years ago

Try to get this option working as currently the publisher got disconnected but not retrying...

Error publishing message: Exception (504) Reason: \"channel/connection is not open\

err := publisher.Publish( []byte(data), []string{keyRouter}, rabbitmq.WithPublishOptionsContentType(publishOptions), rabbitmq.WithPublishOptionsMandatory, rabbitmq.WithPublishOptionsPersistentDelivery, rabbitmq.WithPublishOptionsExchange(exchange), )

publisher, err := rabbitmq.NewPublisher( uriRabbit, amqp091.Config{}, // can pass nothing for no logging rabbitmq.WithPublisherOptionsLogging, )

I see in the code the default if 5 seconds, but it seems to not do it with my current config as I keep getting the same error message no stop.

wagslane commented 2 years ago

I'm sorry, can you please retype this? I'm not understanding the problem, at first it looks like you're saying that the publish option is being used on the consumer, then something about reconnects?

willthrom commented 1 year ago

Sorry, mixed two issues.

The main one is for the publisher doesn't have a reconnect interval Option because the one defined returns a consumer option.

Just try to set to the publisher and change the internal for the retries....


From: Lane Wagner @.> Sent: Friday, May 20, 2022 4:32:40 PM To: wagslane/go-rabbitmq @.> Cc: willthrom @.>; Author @.> Subject: Re: [wagslane/go-rabbitmq] WithPublisherOptionsReconnectInterval is a ConsumerOption. How to use it? (Issue #75)

I'm sorry, can you please retype this? I'm not understanding the problem, at first it looks like you're saying that the publish option is being used on the consumer, then something about reconnects?

— Reply to this email directly, view it on GitHubhttps://github.com/wagslane/go-rabbitmq/issues/75#issuecomment-1133042237, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQBUKO3GDTFYXQZMIFH7E3VK6WBRANCNFSM5V3I4YIQ. You are receiving this because you authored the thread.Message ID: @.***>