-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose-cron-jobs.yml
33 lines (26 loc) · 1.41 KB
/
docker-compose-cron-jobs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
version: '3.8'
services:
hold-processor-job:
image: registry.access.redhat.com/ubi8/python-39
command: >
bash -c "
env
echo -e \"-------- STARTING CRON --------\n\"
echo -e \"endpoint: \\"http://${RABBITMQ_URL}:15672/api/parameters/shovel/%2F/hold-$(date +%s)"\"
echo -e \"amqp_uri: ${AMQP_URI}\"
echo -e \"URL: ${RABBITMQ_URL}\n\"
echo -e \"moving messages from: ${SOURCE_QUEUE} to: ${DESTINATION_QUEUE}\n\"
echo $(curl -v -X PUT \"http://${RABBITMQ_URL}:15672/api/parameters/shovel/%2F/hold-$(date +%s)\" \
--user \"${RABBITMQ_USER}:${RABBITMQ_PASS}\" \
--header \"Content-Type: application/json\" \
--data '{\"value\": {\"src-protocol\":\"amqp091\",\"src-uri\":\"amqp://'${RABBITMQ_USER}':'${RABBITMQ_PASS}'@'${RABBITMQ_URL}'\",\"src-queue\":\"'${SOURCE_QUEUE}'\",\"dest-protocol\": \"amqp091\",\"dest-uri\":\"amqp://'${RABBITMQ_USER}':'${RABBITMQ_PASS}'@'${RABBITMQ_URL}'\",\"dest-queue\":\"'${DESTINATION_QUEUE}'\",\"src-delete-after\": \"queue-length\"}}')
echo -e \"-------- CRON COMPLETE --------\n\"
"
environment:
- RABBITMQ_URL=rabbitmq.example.com
- RABBITMQ_USER=rabbitmq_user
- RABBITMQ_PASS=rabbitmq_password
- AMQP_URI=amqp://guest:[email protected]:5672/
- SOURCE_QUEUE=source_queue_name
- DESTINATION_QUEUE=destination_queue_name
network_mode: "host"