diff --git a/.gitignore b/.gitignore index b0af949..635b79c 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ Temporary Items ### INTELLIJ IDEA ### .idea/ *.iml +/vendor diff --git a/README.md b/README.md index 23d47a4..d448bbd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Cony -High-level AMQP 0.9.1 client library. It's wrapper around low-level [streadway/amqp](https://github.com/streadway/amqp/) library. +High-level AMQP 0.9.1 client library. It's wrapper around low-level [rabbitmq/amqp091-go](https://github.com/rabbitmq/amqp091-go/) library. +This is a fork from github.com/assembla/cony to change from deprecated [streadway/amqp](https://github.com/streadway/amqp/) library. # Goals diff --git a/client.go b/client.go index 89adb18..f493f1d 100644 --- a/client.go +++ b/client.go @@ -2,11 +2,10 @@ package cony import ( "errors" + amqp "github.com/rabbitmq/amqp091-go" "sync" "sync/atomic" "time" - - "github.com/streadway/amqp" ) const ( @@ -32,7 +31,7 @@ type Client struct { errs chan error blocking chan amqp.Blocking run int32 // bool - conn atomic.Value //*amqp.Connection + conn atomic.Value // *amqp.Connection bo Backoffer attempt int32 l sync.Mutex diff --git a/client_test.go b/client_test.go index 827a8c5..0eeb238 100644 --- a/client_test.go +++ b/client_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) func TestNewClient(t *testing.T) { diff --git a/consumer.go b/consumer.go index 522afa3..5c606de 100644 --- a/consumer.go +++ b/consumer.go @@ -5,7 +5,7 @@ import ( "os" "sync" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) // ConsumerOpt is a consumer's functional option type diff --git a/consumer_test.go b/consumer_test.go index 83f9097..d6eb1e5 100644 --- a/consumer_test.go +++ b/consumer_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) func TestAutoAck(t *testing.T) { diff --git a/cony.go b/cony.go index 37e3143..4b73522 100644 --- a/cony.go +++ b/cony.go @@ -6,7 +6,7 @@ package cony import ( "sync" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) // Queue hold definition of AMQP queue diff --git a/cony_test.go b/cony_test.go index b1aedd1..95d2edd 100644 --- a/cony_test.go +++ b/cony_test.go @@ -1,6 +1,6 @@ package cony -import "github.com/streadway/amqp" +import amqp "github.com/rabbitmq/amqp091-go" type mqDeleterTest struct { _deletePublisher func(*Publisher) diff --git a/declaration.go b/declaration.go index ea5784a..4d75fa7 100644 --- a/declaration.go +++ b/declaration.go @@ -1,6 +1,6 @@ package cony -import "github.com/streadway/amqp" +import amqp "github.com/rabbitmq/amqp091-go" // Declaration is a callback type to declare AMQP queue/exchange/binding type Declaration func(Declarer) error diff --git a/declaration_test.go b/declaration_test.go index 776d120..b42a340 100644 --- a/declaration_test.go +++ b/declaration_test.go @@ -3,7 +3,7 @@ package cony import ( "testing" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) type testDeclarer struct { diff --git a/doc_test.go b/doc_test.go index ed91924..ff0f753 100644 --- a/doc_test.go +++ b/doc_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/assembla/cony" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) func Example() { diff --git a/examples/basic/producer/producer.go b/examples/basic/producer/producer.go index 93e4fe5..fc1ddb4 100644 --- a/examples/basic/producer/producer.go +++ b/examples/basic/producer/producer.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/assembla/cony" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" "time" ) diff --git a/examples/email/producer/producer.go b/examples/email/producer/producer.go index 7314691..5fee40e 100644 --- a/examples/email/producer/producer.go +++ b/examples/email/producer/producer.go @@ -9,7 +9,7 @@ import ( "net/http" "github.com/assembla/cony" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) var port = flag.Int("port", 3000, "listening port") diff --git a/examples/web/producer/producer.go b/examples/web/producer/producer.go index 0362703..59ce235 100644 --- a/examples/web/producer/producer.go +++ b/examples/web/producer/producer.go @@ -8,7 +8,7 @@ import ( "net/http" "github.com/assembla/cony" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) var port = flag.Int("port", 3000, "listening port") diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..175ffb1 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/assembla/cony + +go 1.19 + +require github.com/rabbitmq/amqp091-go v1.9.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ab0418f --- /dev/null +++ b/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rabbitmq/amqp091-go v1.9.0 h1:qrQtyzB4H8BQgEuJwhmVQqVHB9O4+MNDJCCAcpc3Aoo= +github.com/rabbitmq/amqp091-go v1.9.0/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/publisher.go b/publisher.go index a2c6d5d..15069d6 100644 --- a/publisher.go +++ b/publisher.go @@ -4,7 +4,7 @@ import ( "errors" "sync" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) // ErrPublisherDead indicates that publisher was canceled, could be returned diff --git a/publisher_test.go b/publisher_test.go index 06e800f..40c0cf5 100644 --- a/publisher_test.go +++ b/publisher_test.go @@ -6,7 +6,7 @@ import ( "io" "testing" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) func TestPublisherImplements_io_Writer(t *testing.T) {