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
805 stars 128 forks source link

Remove deprecated 'Publish' method #93

Closed aaqaishtyaq closed 1 year ago

aaqaishtyaq commented 1 year ago

This PR adds PublishWithContext for publishing to Rabbitmq.

As a requirement, github.com/rabbitmq/amqp091-go needs to be updated. Removed vendor directory, in favor of go mod download

Fixes: #90

aaqaishtyaq commented 1 year ago

@wagslane Please review.

wagslane commented 1 year ago

Hmmm, I think it would be better to have an entirely separate function called PublishWithContext? thoughts?

aaqaishtyaq commented 1 year ago

Ideally it should be a different method. Publish is deprecated but it is not removed.

From the perspective of this library. User should not worry about different ways to Publish. It should be just one method to remove ambiguity. Rabbitmq does not want to break their current API but we have already changed our API. IMO, We can accommodate this as part of current Publish method (Create a new release with major version change).

If you think we should have a separate method for PublishWithContext then I can update the PR.

wagslane commented 1 year ago

Yeah, I think it would be best to have two separate functions!

pwli0755 commented 1 year ago

any updates on this thread? I really need this Context intergration in my tracing scenarios. I personally prefer add the WithContext approach and leave old API as deprecated.

aaqaishtyaq commented 1 year ago

@wagslane, Please review.

I had to update examples because the staticcheck was failing due to the usage of the deprecated Publish method.

bpartov-tc commented 1 year ago

I am interested in this pull request as well, is this branch being merged any time soon?