Skip to content

Commit 2f30da5

Browse files
Change SQS to use fifo queue
This should improve the retention of results received by the cli.
1 parent 16da702 commit 2f30da5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

infrastructure/aws/aws.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,16 @@ func (infra *AwsInfrastructure) createSQSQueue() (url string, err error) {
344344
svc := sqs.New(session.New(), infra.config)
345345

346346
resp, err := svc.CreateQueue(&sqs.CreateQueueInput{
347-
QueueName: aws.String("goad-" + uuid.NewV4().String()),
347+
QueueName: aws.String("goad-" + uuid.NewV4().String() + ".fifo"),
348+
Attributes: map[string]*string{
349+
"FifoQueue": aws.String("true"),
350+
},
348351
})
349352

350353
if err != nil {
351354
return "", err
352355
}
353-
356+
fmt.Println(*resp.QueueUrl)
354357
return *resp.QueueUrl, nil
355358
}
356359

infrastructure/aws/sqs/sqsadapter.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/aws/aws-sdk-go/aws/session"
99
"github.com/aws/aws-sdk-go/service/sqs"
1010
"github.com/goadapp/goad/api"
11+
uuid "github.com/satori/go.uuid"
1112
)
1213

1314
// Adapter is used to send messages to the queue
@@ -103,8 +104,10 @@ func (adaptor Adapter) SendResult(result api.RunnerResult) error {
103104
panic(jsonerr)
104105
}
105106
params := &sqs.SendMessageInput{
106-
MessageBody: aws.String(str),
107-
QueueUrl: aws.String(adaptor.QueueURL),
107+
MessageBody: aws.String(str),
108+
MessageGroupId: aws.String("goad-lambda"),
109+
MessageDeduplicationId: aws.String(uuid.NewV4().String()),
110+
QueueUrl: aws.String(adaptor.QueueURL),
108111
}
109112
_, err := adaptor.Client.SendMessage(params)
110113

0 commit comments

Comments
 (0)