From ea421cc23a8d72ae495e9daabd704386cd37ec0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sefa=C2=A0=C5=9Eent=C3=BCrk?= Date: Tue, 26 Oct 2021 20:48:16 +0200 Subject: [PATCH] Add `MessageAttributeNames` to receive input of sqs --- cmd/example-worker/main.go | 5 ++--- go.mod | 2 +- worker/worker.go | 3 +++ worker/worker_test.go | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/example-worker/main.go b/cmd/example-worker/main.go index 3053f0b..aef1727 100644 --- a/cmd/example-worker/main.go +++ b/cmd/example-worker/main.go @@ -3,12 +3,11 @@ package main import ( "context" "fmt" - "os" - + "github.com/Sef1995/go-sqs-poller/worker" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/service/sqs" - "github.com/h2ik/go-sqs-poller/v3/worker" + "os" ) func main() { diff --git a/go.mod b/go.mod index 82bed98..f8db52d 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/h2ik/go-sqs-poller/v3 +module github.com/Sef1995/go-sqs-poller require ( github.com/aws/aws-sdk-go v1.6.18 diff --git a/worker/worker.go b/worker/worker.go index 93e2a7a..cfd5a56 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -95,6 +95,9 @@ func (worker *Worker) Start(ctx context.Context, h Handler) { AttributeNames: []*string{ aws.String("All"), // Required }, + MessageAttributeNames: []*string{ + aws.String(sqs.QueueAttributeNameAll), + }, WaitTimeSeconds: aws.Int64(worker.Config.WaitTimeSecond), } diff --git a/worker/worker_test.go b/worker/worker_test.go index a85b417..bc029b7 100644 --- a/worker/worker_test.go +++ b/worker/worker_test.go @@ -131,5 +131,8 @@ func buildClientParams() *sqs.ReceiveMessageInput { MaxNumberOfMessages: aws.Int64(maxNumberOfMessages), AttributeNames: []*string{aws.String("All")}, WaitTimeSeconds: aws.Int64(waitTimeSecond), + MessageAttributeNames: []*string{ + aws.String(sqs.QueueAttributeNameAll), + }, } }