sqs-browse: a lot of work to try to keep UI complexity down

Added the notion of controllers and a dispatcher which will queue up operations
This commit is contained in:
Leon Mika 2022-03-23 15:40:31 +11:00
parent 1969504611
commit 7526c095ee
24 changed files with 602 additions and 97 deletions

View file

@ -19,6 +19,20 @@ func NewProvider(client *sqs.Client) *Provider {
return &Provider{client: client}
}
func (p *Provider) SendMessage(ctx context.Context, msg models.Message, queue string) (string, error) {
// TEMP :: queue URL
out, err := p.client.SendMessage(ctx, &sqs.SendMessageInput{
QueueUrl: aws.String(queue),
MessageBody: aws.String(msg.Data),
})
if err != nil {
return "", errors.Wrapf(err, "unable to send message to %v", queue)
}
return aws.ToString(out.MessageId), nil
}
func (p *Provider) PollForNewMessages(ctx context.Context, queue string) ([]*models.Message, error) {
out, err := p.client.ReceiveMessage(ctx, &sqs.ReceiveMessageInput{
QueueUrl: aws.String(queue),