Skip to content

Commit

Permalink
Publish index tasks on topic exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
stchris committed Jul 24, 2024
1 parent 995743f commit db3fab5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions servicelayer/taskqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,20 @@ def queue_task(
"priority": priority,
}
try:
exchange = ""
routing_key = stage
if stage == "index":
exchange = "amq.topic"
if collection_id:
routing_key += f".{collection_id}"
else:
routing_key += ".0"
log.debug(
f"Publish to exchange '{exchange}' with routing_key {routing_key}"
) # noqa
rmq_channel.basic_publish(
exchange="",
routing_key=stage,
exchange=exchange,
routing_key=routing_key,
body=json.dumps(body),
properties=pika.BasicProperties(
delivery_mode=pika.spec.PERSISTENT_DELIVERY_MODE, priority=priority
Expand Down

0 comments on commit db3fab5

Please sign in to comment.