Skip to content

Commit

Permalink
Get rid of dependence on 'Micro-Topic'
Browse files Browse the repository at this point in the history
  • Loading branch information
maxinglun committed Apr 9, 2022
1 parent 90a1b34 commit 3ff6944
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/broker/rabbitmq/rabbitmq.go
Expand Up @@ -7,9 +7,9 @@ import (
"sync"
"time"

"github.com/streadway/amqp"
"go-micro.dev/v4/broker"
"go-micro.dev/v4/cmd"
"github.com/streadway/amqp"
)

type rbroker struct {
Expand Down Expand Up @@ -267,6 +267,13 @@ func (r *rbroker) Subscribe(topic string, handler broker.Handler, opts ...broker
for k, v := range msg.Headers {
header[k], _ = v.(string)
}

// Get rid of dependence on 'Micro-Topic'
msgTopic := header["Micro-Topic"]
if msgTopic == "" {
header["Micro-Topic"] = msg.RoutingKey
}

m := &broker.Message{
Header: header,
Body: msg.Body,
Expand Down

0 comments on commit 3ff6944

Please sign in to comment.