Skip to content

Commit a9db7ae

Browse files
authored
Merge pull request #450 from Azuka/feature/fix-pubsub-publish
Fix pubsub routing key.
2 parents 5920c86 + 5f3cd76 commit a9db7ae

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

v1/brokers/gcppubsub/gcp_pubsub.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ func (b *Broker) StopConsuming() {
125125
<-b.stopDone
126126
}
127127

128-
// Publish places a new message on the default queue
128+
// Publish places a new message on the default queue or the queue pointed to
129+
// by the routing key
129130
func (b *Broker) Publish(ctx context.Context, signature *tasks.Signature) error {
130131
// Adjust routing key (this decides which queue the message will be published to)
131132
b.AdjustRoutingKey(signature)
@@ -135,8 +136,7 @@ func (b *Broker) Publish(ctx context.Context, signature *tasks.Signature) error
135136
return fmt.Errorf("JSON marshal error: %s", err)
136137
}
137138

138-
defaultQueue := b.GetConfig().DefaultQueue
139-
topic := b.service.Topic(defaultQueue)
139+
topic := b.service.Topic(signature.RoutingKey)
140140
defer topic.Stop()
141141

142142
// Check the ETA signature field, if it is set and it is in the future,

0 commit comments

Comments
 (0)