Skip to content

Commit

Permalink
Fix AMQP broker
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Nelson committed Feb 14, 2022
1 parent 32790be commit 47f5757
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/mediocregopher/radix/v4"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rabbitmq/amqp091-go"
"github.com/spec-tacles/gateway/config"
"github.com/spec-tacles/gateway/gateway"
"github.com/spec-tacles/go/broker"
Expand Down Expand Up @@ -83,10 +84,17 @@ func Run() {

switch conf.Broker.Type {
case "amqp":
b = &amqp.AMQP{
conn, err := amqp091.Dial(conf.AMQP.URL)
if err != nil {
logger.Fatalf("error connecting to AMQP: %s", err)
}

amqp := &amqp.AMQP{
Group: conf.Broker.Group,
Timeout: conf.Broker.MessageTimeout.Duration,
}
amqp.Init(conn)
b = amqp
case "redis":
client := getRedis(ctx, conf)
r := redis.NewRedis(client, conf.Broker.Group)
Expand Down

0 comments on commit 47f5757

Please sign in to comment.