From b139273603838768c056437e4ea10482872eea37 Mon Sep 17 00:00:00 2001 From: Leo Davis <3577372+ldav1s@users.noreply.github.com> Date: Mon, 21 Sep 2020 12:37:18 -0600 Subject: [PATCH 1/3] Fix typo. --- utils/opt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/opt.go b/utils/opt.go index d643ce0..3b51687 100644 --- a/utils/opt.go +++ b/utils/opt.go @@ -41,7 +41,7 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) { ) if wrongOpt, ok := checkOptions(opt); !ok { - return amqp.Publishing{}, fmt.Errorf("Wring option '%s'. Check the docs.", wrongOpt) + return amqp.Publishing{}, fmt.Errorf("Wrong option '%s'. Check the docs.", wrongOpt) } if opt != nil { From d769d26edb7c934342273216df889078190cee55 Mon Sep 17 00:00:00 2001 From: Leo Davis <3577372+ldav1s@users.noreply.github.com> Date: Mon, 21 Sep 2020 12:39:42 -0600 Subject: [PATCH 2/3] Add CorrelationId to amqp.Publishing. --- utils/opt.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/opt.go b/utils/opt.go index 3b51687..a86f1d3 100644 --- a/utils/opt.go +++ b/utils/opt.go @@ -17,6 +17,7 @@ var ( "deliveryMode", "priority", "messageId", + "correlationId", } ) @@ -38,6 +39,7 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) { deliveryMode = amqp.Transient priority = uint8(0) messageId = "" + correlationId = "" ) if wrongOpt, ok := checkOptions(opt); !ok { @@ -68,6 +70,10 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) { if p, ok := opt["messageId"].(string); ok { messageId = p } + + if p, ok := opt["correlationId"].(string); ok { + correlationId = p + } } return amqp.Publishing{ @@ -77,6 +83,7 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) { DeliveryMode: deliveryMode, // 1=non-persistent, 2=persistent Priority: priority, // 0-9 MessageId: messageId, + CorrelationId: correlationId, // a bunch of application/implementation-specific fields }, nil } From d217b7f1c3ca7ede045a00943190159f2c52b431 Mon Sep 17 00:00:00 2001 From: Leo Davis <3577372+ldav1s@users.noreply.github.com> Date: Mon, 21 Sep 2020 14:16:24 -0600 Subject: [PATCH 3/3] Added expiration. --- utils/opt.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/opt.go b/utils/opt.go index a86f1d3..2e077ce 100644 --- a/utils/opt.go +++ b/utils/opt.go @@ -18,6 +18,7 @@ var ( "priority", "messageId", "correlationId", + "expiration", } ) @@ -40,6 +41,7 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) { priority = uint8(0) messageId = "" correlationId = "" + expiration = "" ) if wrongOpt, ok := checkOptions(opt); !ok { @@ -74,6 +76,10 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) { if p, ok := opt["correlationId"].(string); ok { correlationId = p } + + if p, ok := opt["expiration"].(string); ok { + expiration = p + } } return amqp.Publishing{ @@ -84,6 +90,7 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) { Priority: priority, // 0-9 MessageId: messageId, CorrelationId: correlationId, + Expiration: expiration, // a bunch of application/implementation-specific fields }, nil }