From 1c607bbbdc28beae0df18607aa6967f775b8e01c Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 28 Jul 2020 09:23:36 +1000 Subject: [PATCH] make all options the same for mq --- main.go | 58 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/main.go b/main.go index 942dd58e..f74a0f67 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ package main import ( "flag" + "fmt" "os" "time" @@ -109,37 +110,56 @@ func main() { Name: "lagoon-tasks", Type: "direct", Options: mq.Options{ - "durable": true, + "durable": true, + "delivery_mode": "2", + "headers": "", + "content_type": "", }, }, }, Consumers: mq.Consumers{ { - Name: "remove-queue", - // RoutingKey: lagoonTargetName + ":remove", - Queue: "lagoon-tasks:" + lagoonTargetName + ":remove", + Name: "remove-queue", + Queue: fmt.Sprintf("lagoon-tasks:%s:remove", lagoonTargetName), Workers: 1, + Options: mq.Options{ + "durable": true, + "delivery_mode": "2", + "headers": "", + "content_type": "", + }, }, { - Name: "builddeploy-queue", - // RoutingKey: lagoonTargetName + ":builddeploy", - Queue: "lagoon-tasks:" + lagoonTargetName + ":builddeploy", + Name: "builddeploy-queue", + Queue: fmt.Sprintf("lagoon-tasks:%s:builddeploy", lagoonTargetName), Workers: 1, + Options: mq.Options{ + "durable": true, + "delivery_mode": "2", + "headers": "", + "content_type": "", + }, }, }, Queues: mq.Queues{ { - Name: "lagoon-tasks:" + lagoonTargetName + ":builddeploy", + Name: fmt.Sprintf("lagoon-tasks:%s:builddeploy", lagoonTargetName), Exchange: "lagoon-tasks", - RoutingKey: lagoonTargetName + ":builddeploy", + RoutingKey: fmt.Sprintf("%s:builddeploy", lagoonTargetName), Options: mq.Options{ - "durable": true, + "durable": true, + "delivery_mode": "2", + "headers": "", + "content_type": "", }, }, { - Name: "lagoon-tasks:" + lagoonTargetName + ":remove", + Name: fmt.Sprintf("lagoon-tasks:%s:remove", lagoonTargetName), Exchange: "lagoon-tasks", - RoutingKey: lagoonTargetName + ":remove", + RoutingKey: fmt.Sprintf("%s:remove", lagoonTargetName), Options: mq.Options{ - "durable": true, + "durable": true, + "delivery_mode": "2", + "headers": "", + "content_type": "", }, }, }, @@ -148,9 +168,10 @@ func main() { Name: "lagoon-logs", Exchange: "lagoon-logs", Options: mq.Options{ - "content_type": "text/plain", "app_id": lagoonAppID, - "delivery_mode": 2, + "delivery_mode": "2", + "headers": "", + "content_type": "", }, }, { @@ -158,13 +179,14 @@ func main() { Exchange: "lagoon-tasks", RoutingKey: "operator", Options: mq.Options{ - "content_type": "text/plain", "app_id": lagoonAppID, - "delivery_mode": 2, + "delivery_mode": "2", + "headers": "", + "content_type": "", }, }, }, - DSN: "amqp://" + mqUser + ":" + mqPass + "@" + mqHost + "/", + DSN: fmt.Sprintf("amqp://%s:%s@%s/", mqUser, mqPass, mqHost), } messaging := handlers.NewMessaging(config, mgr.GetClient()) // if we are running with MQ support, then start the consumer handler