Skip to content

Commit c2fce7e

Browse files
author
Traun Leyden
committed
just use the routing key as the queue name, since there's no reason to have a different name
1 parent 6e8abed commit c2fce7e

File tree

3 files changed

+31
-28
lines changed

3 files changed

+31
-28
lines changed

ocr_rpc_worker.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ func (w OcrRpcWorker) Run() error {
6464
return err
6565
}
6666

67+
// just use the routing key as the queue name, since there's no reason
68+
// to have a different name
69+
queueName := w.rabbitConfig.RoutingKey
70+
6771
queue, err := w.channel.QueueDeclare(
68-
w.rabbitConfig.QueueName, // name of the queue
69-
true, // durable
70-
false, // delete when usused
71-
false, // exclusive
72-
false, // noWait
73-
nil, // arguments
72+
queueName, // name of the queue
73+
true, // durable
74+
false, // delete when usused
75+
false, // exclusive
76+
false, // noWait
77+
nil, // arguments
7478
)
7579
if err != nil {
7680
return err

preprocessor_rpc_worker.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,23 @@ func (w PreprocessorRpcWorker) Run() error {
6363
return err
6464
}
6565

66+
// just call the queue the same name as the binding key, since
67+
// there is no reason to have a different name.
68+
bindingKey := "stroke-width-transform"
69+
queueName := bindingKey
70+
6671
queue, err := w.channel.QueueDeclare(
67-
w.rabbitConfig.PreprocessorQueueName, // name of the queue
68-
true, // durable
69-
false, // delete when usused
70-
false, // exclusive
71-
false, // noWait
72-
nil, // arguments
72+
queueName, // name of the queue
73+
true, // durable
74+
false, // delete when usused
75+
false, // exclusive
76+
false, // noWait
77+
nil, // arguments
7378
)
7479
if err != nil {
7580
return err
7681
}
7782

78-
bindingKey := "stroke-width-transform"
79-
8083
if err = w.channel.QueueBind(
8184
queue.Name, // name of the queue
8285
bindingKey, // bindingKey

rabbit_config.go

+10-14
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import (
55
)
66

77
type RabbitConfig struct {
8-
AmqpURI string
9-
Exchange string
10-
ExchangeType string
11-
RoutingKey string
12-
Reliable bool
13-
QueueName string
14-
PreprocessorQueueName string
8+
AmqpURI string
9+
Exchange string
10+
ExchangeType string
11+
RoutingKey string
12+
Reliable bool
1513
}
1614

1715
func DefaultTestConfig() RabbitConfig {
@@ -21,13 +19,11 @@ func DefaultTestConfig() RabbitConfig {
2119
// higher would delay the problem, but then it would still happen later.
2220

2321
rabbitConfig := RabbitConfig{
24-
AmqpURI: "amqp://guest:guest@localhost:5672/",
25-
Exchange: "open-ocr-exchange3",
26-
ExchangeType: "direct",
27-
RoutingKey: "decode-ocr",
28-
Reliable: false, // setting to false because of observed issues
29-
QueueName: "open-ocr-queue",
30-
PreprocessorQueueName: "preprocessor-queue",
22+
AmqpURI: "amqp://guest:guest@localhost:5672/",
23+
Exchange: "open-ocr-exchange",
24+
ExchangeType: "direct",
25+
RoutingKey: "decode-ocr",
26+
Reliable: false, // setting to false because of observed issues
3127
}
3228
return rabbitConfig
3329

0 commit comments

Comments
 (0)