Skip to content

Commit

Permalink
pubsub/rabbitpubsub: Switch to using github.com/rabbitmq/amqp091-go.
Browse files Browse the repository at this point in the history
  • Loading branch information
vangent committed May 23, 2022
1 parent eecd4f0 commit a82c940
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion internal/testing/alldeps
Expand Up @@ -119,9 +119,9 @@ github.com/nats-io/nuid
github.com/oklog/run
github.com/pierrec/lz4
github.com/pkg/errors
github.com/rabbitmq/amqp091-go
github.com/rcrowley/go-metrics
github.com/ryanuber/go-glob
github.com/streadway/amqp
github.com/xdg-go/pbkdf2
github.com/xdg-go/scram
github.com/xdg-go/stringprep
Expand Down
8 changes: 5 additions & 3 deletions pubsub/rabbitpubsub/amqp.go
Expand Up @@ -17,7 +17,9 @@ package rabbitpubsub
// Interfaces for the AMQP protocol, and adapters for the real amqp client.
// Fake implementations of the interfaces are in fake_test.go

import "github.com/streadway/amqp"
import (
amqp "github.com/rabbitmq/amqp091-go"
)

// Values we use for the amqp client.
// See https://www.rabbitmq.com/amqp-0-9-1-reference.html.
Expand All @@ -39,13 +41,13 @@ const (
immediate = false
)

// See https://godoc.org/github.com/streadway/amqp#Connection for the documentation of these methods.
// See https://pkg.go.dev/github.com/rabbitmq/amqp091-go#Connection for the documentation of these methods.
type amqpConnection interface {
Channel() (amqpChannel, error)
Close() error
}

// See https://godoc.org/github.com/streadway/amqp#Channel for the documentation of these methods.
// See https://pkg.go.dev/github.com/rabbitmq/amqp091-go#Channel for the documentation of these methods.
type amqpChannel interface {
Publish(exchange string, msg amqp.Publishing) error
Consume(queue, consumer string) (<-chan amqp.Delivery, error)
Expand Down
2 changes: 1 addition & 1 deletion pubsub/rabbitpubsub/example_test.go
Expand Up @@ -18,7 +18,7 @@ import (
"context"
"log"

"github.com/streadway/amqp"
amqp "github.com/rabbitmq/amqp091-go"
"gocloud.dev/pubsub"
"gocloud.dev/pubsub/rabbitpubsub"
)
Expand Down
2 changes: 1 addition & 1 deletion pubsub/rabbitpubsub/fake_test.go
Expand Up @@ -23,7 +23,7 @@ import (
"sync"
"time"

"github.com/streadway/amqp"
amqp "github.com/rabbitmq/amqp091-go"
)

// fakeConnection implements the amqpConnection interface.
Expand Down
2 changes: 1 addition & 1 deletion pubsub/rabbitpubsub/go.mod
Expand Up @@ -17,7 +17,7 @@ module gocloud.dev/pubsub/rabbitpubsub
go 1.12

require (
github.com/streadway/amqp v1.0.0
github.com/rabbitmq/amqp091-go v1.3.4
gocloud.dev v0.25.0
)

Expand Down
4 changes: 2 additions & 2 deletions pubsub/rabbitpubsub/go.sum
Expand Up @@ -408,6 +408,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rabbitmq/amqp091-go v1.3.4 h1:tXuIslN1nhDqs2t6Jrz3BAoqvt4qIZzxvdbdcxWtHYU=
github.com/rabbitmq/amqp091-go v1.3.4/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
Expand All @@ -419,8 +421,6 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo=
github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
Expand Down
6 changes: 3 additions & 3 deletions pubsub/rabbitpubsub/rabbit.go
Expand Up @@ -26,7 +26,7 @@ import (
"sync/atomic"
"time"

"github.com/streadway/amqp"
amqp "github.com/rabbitmq/amqp091-go"
"gocloud.dev/gcerrors"
"gocloud.dev/pubsub"
"gocloud.dev/pubsub/driver"
Expand Down Expand Up @@ -440,8 +440,8 @@ func isRetryable(err error) bool {
// But it actually means "can be recovered by retrying later or with different
// parameters," which is not what we want. The error codes for which Recover is
// true, defined in the isSoftExceptionCode function of
// github.com/streadway/amqp/spec091.go, include things like NotFound and
// AccessRefused, which require outside action.
// https://github.com/rabbitmq/amqp091-go/blob/main/spec091.go, includng things
// like NotFound and AccessRefused, which require outside action.
//
// The following are the codes which might be resolved by retry without external
// action, according to the AMQP 0.91 spec
Expand Down
2 changes: 1 addition & 1 deletion pubsub/rabbitpubsub/rabbit_test.go
Expand Up @@ -30,7 +30,7 @@ import (
"testing"
"time"

"github.com/streadway/amqp"
amqp "github.com/rabbitmq/amqp091-go"
"gocloud.dev/gcerrors"
"gocloud.dev/internal/testing/setup"
"gocloud.dev/pubsub"
Expand Down
2 changes: 2 additions & 0 deletions samples/go.sum
Expand Up @@ -670,6 +670,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/rabbitmq/amqp091-go v1.3.4 h1:tXuIslN1nhDqs2t6Jrz3BAoqvt4qIZzxvdbdcxWtHYU=
github.com/rabbitmq/amqp091-go v1.3.4/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
Expand Down

0 comments on commit a82c940

Please sign in to comment.