Files
query-orchestration/internal/server/queue/send.go
T
Michael McGuinness fa95d733ca Merged in feature/shorttestsanddirtidy (pull request #26)
Add short tests and Tidy internal directories

* complete the tasks
2025-01-17 12:00:32 +00:00

31 lines
649 B
Go

package queue
import (
"context"
"encoding/json"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/aws/aws-sdk-go-v2/service/sqs/types"
)
func Send(ctx context.Context, config *Config, body interface{}, attributes map[string]types.MessageAttributeValue) error {
jsonBytes, err := json.Marshal(body)
if err != nil {
return err
}
strBody := string(jsonBytes)
_, err = config.Client.SendMessage(ctx, &sqs.SendMessageInput{
MessageAttributes: attributes,
QueueUrl: aws.String(config.URL),
MessageBody: aws.String(strBody),
})
if err != nil {
return err
}
return nil
}