Skip to content

Commit

Permalink
Merge pull request #23 from furdarius/update_amqp_190
Browse files Browse the repository at this point in the history
Update dependencies: Go=>1.20, amqp091-go=>v1.9.0
  • Loading branch information
furdarius authored Mar 3, 2024
2 parents 9bae7d9 + e12f9bc commit e6b2135
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 31 deletions.
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,13 @@ The library is designed to save the developer from the headache when working wit
* Supports pool of channels used for publishing.
* Provides channels [pool size](https://godoc.org/github.com/furdarius/rabbitroutine#Pool.Size) statistics.

**Stop to do wrappers, do features!**

## Install
```
go get github.com/furdarius/rabbitroutine
```
## Usage

### Adding as dependency by "go dep"
```
$ dep ensure -add github.com/furdarius/rabbitroutine
go get github.com/furdarius/rabbitroutine
```

## Usage


### Consuming
You need to implement [Consumer](https://godoc.org/github.com/furdarius/rabbitroutine#Consumer) and register
Expand Down Expand Up @@ -119,9 +112,14 @@ if err != nil {
Pull requests are very much welcomed. Create your pull request, make sure a test or example is included that covers your change and
your commits represent coherent changes that include a reason for the change.

To run the integration tests, make sure you have RabbitMQ running on any host (e.g with `docker run --net=host -it --rm rabbitmq`), then
export the environment variable `AMQP_URL=amqp://host/` and run `go test -tags
integration`. As example:
To run the integration tests, make sure you have RabbitMQ running on any host
```
docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.13-management
```

Then export the environment variable `AMQP_URL=amqp://host/` and run `go test -tags
integration`.

```
AMQP_URL=amqp://guest:[email protected]:5672/ go test -v -race -cpu=1,2 -tags integration -timeout 5s
```
Expand All @@ -130,5 +128,3 @@ Use [golangci-lint](https://github.com/golangci/golangci-lint) to check code wit
```
golangci-lint run ./...
```

TravisCI will also run the integration tests and golangci-lint.
6 changes: 6 additions & 0 deletions examples/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
rabbitmq:
image: rabbitmq:3.13-management
ports:
- "5672:5672"
- "15672:15672"
6 changes: 0 additions & 6 deletions examples/docker-compose.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/furdarius/rabbitroutine

go 1.18
go 1.20

require (
github.com/pkg/errors v0.9.1
github.com/rabbitmq/amqp091-go v1.8.1
github.com/stretchr/testify v1.8.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
github.com/rabbitmq/amqp091-go v1.9.0
github.com/stretchr/testify v1.9.0
golang.org/x/sync v0.6.0
)

require (
Expand Down
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
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/rabbitmq/amqp091-go v1.8.1 h1:RejT1SBUim5doqcL6s7iN6SBmsQqyTgXb1xMlH0h1hA=
github.com/rabbitmq/amqp091-go v1.8.1/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc=
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 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
4 changes: 2 additions & 2 deletions publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (p *EnsurePublisher) publish(ctx context.Context, k ChannelKeeper, exchange

mandatory := true
immediate := false
err := ch.Publish(exchange, key, mandatory, immediate, msg)
err := ch.PublishWithContext(ctx, exchange, key, mandatory, immediate, msg)
if err != nil {
return errors.Wrap(err, "failed to publish message")
}
Expand Down Expand Up @@ -127,7 +127,7 @@ func (p *FireForgetPublisher) Publish(ctx context.Context, exchange, key string,

mandatory := false
immediate := false
err = ch.Publish(exchange, key, mandatory, immediate, msg)
err = ch.PublishWithContext(ctx, exchange, key, mandatory, immediate, msg)
if err != nil {
_ = ch.Close() //nolint: gosec

Expand Down

0 comments on commit e6b2135

Please sign in to comment.