From 2fe5c0b285cef4c36813f7949af0a39c0dbd58c9 Mon Sep 17 00:00:00 2001 From: Benjamin Quinn Date: Wed, 3 Nov 2021 09:50:53 -0400 Subject: [PATCH] Add sqs and dynamodb prefixes to connection urls --- v1/factories.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/v1/factories.go b/v1/factories.go index 907cf56e..2e1c0965 100644 --- a/v1/factories.go +++ b/v1/factories.go @@ -94,6 +94,12 @@ func BrokerFactory(cnf *config.Config) (brokeriface.Broker, error) { if strings.HasPrefix(cnf.Broker, "https://sqs") { return sqsbroker.New(cnf), nil } + + const sqsPrefix = "sqs+" + if strings.HasPrefix(cnf.Broker, sqsPrefix) { + cnf.Broker = strings.TrimPrefix(cnf.Broker, sqsPrefix) + return sqsbroker.New(cnf), nil + } } if strings.HasPrefix(cnf.Broker, "gcppubsub://") { @@ -179,6 +185,12 @@ func BackendFactory(cnf *config.Config) (backendiface.Backend, error) { return dynamobackend.New(cnf), nil } + const dynamodbPrefix = "dynamodb+" + if strings.HasPrefix(cnf.ResultBackend, dynamodbPrefix) { + cnf.ResultBackend = strings.TrimPrefix(cnf.ResultBackend, dynamodbPrefix) + return dynamobackend.New(cnf), nil + } + return nil, fmt.Errorf("Factory failed with result backend: %v", cnf.ResultBackend) }