Skip to content

Commit

Permalink
docs: add redis transport sections (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemorage authored Oct 20, 2023
1 parent 97f0d46 commit a6e97ff
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Consume your messages directly with Go code
- PostgreSQL support
- AMQP support
- Redis support

## Installation
Install gosumer with Go
Expand Down Expand Up @@ -38,7 +39,7 @@ Don't forget to specify in the `routing` part the message to process in Go


### RabbitMQ
Create a env variable to create a custom queue (in this example `go` is the name of the queue):
Create an env variable to create a custom queue (in this example `go` is the name of the queue):
```
RABBITMQ_GO_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/go
```
Expand All @@ -57,6 +58,25 @@ framework:
multiplier: 2
```

### Redis
Create an env variable for Redis:
```
REDIS_TRANSPORT_DSN=redis://localhost:6379/messages
```

Add the following to your `config/packages/messenger.yaml`:

```yaml
framework:
messenger:
transports:
async:
dsn: "%env(MESSENGER_TRANSPORT_DSN)%"
options: []
```

Make sure to specify the message routing in the `routing` section to process in Go.

## Usage
### Configure the transport
For PostgreSQL:
Expand All @@ -82,6 +102,18 @@ database := gosumer.RabbitMQ{
}
```

For Redis:
```go
database := gosumer.Redis{
Host: "localhost",
Port: 6379,
User: "username",
Password: "password",
DB: 0,
Channel: "channel_name",
}
```

### Listen for messages
Call the Listen
```go
Expand Down

0 comments on commit a6e97ff

Please sign in to comment.