essqs

package
v0.0.0-...-7aaf587 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package essqs contains AWS SQS client to receive notifications from Event Store

The client is useful when you subscribe to the Event Store notifications with SQS and process it e.g. in an ECS or EC2 deployed service.

For AWS Lambda this client is not needed, since you'll get SQS message directly as a Lambda input.

To get started you need an AWS SQS client and queue URL:

import (
  "context"
  "github.com/aws/aws-sdk-go-v2/config"
  "github.com/aws/aws-sdk-go-v2/service/sqs"
  "github.com/ilia-tolliu/serverless-event-store/essqs"
)

func bootstrap() (*essqs.Client, error) {
  awsConfig, err := config.LoadDefaultConfig(context.Background())
  // handle err

  sqsClient := sqs.NewFromConfig(awsConfig)
  esSqsClient := essqs.NewClient(sqsClient, "https://sqs.eu-central-1.amazonaws.com/****/queue-name")

  return esSqsClient
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(sqsClient *sqs.Client, queueUrl string) *Client

func (*Client) AcknowledgeNotification

func (c *Client) AcknowledgeNotification(ctx context.Context, notification esnotification.EsNotification) error

AcknowledgeNotification deletes an Event Store notification from SQS after successful processing.

func (*Client) ReceiveNotifications

func (c *Client) ReceiveNotifications(ctx context.Context) ([]esnotification.EsNotification, error)

ReceiveNotifications retrieves pending Event Store notifications from SQS queue

The Event Store payload is extracted from SQS message and SNS message. Once received notification is processed, you should acknowledge it to delete from SQS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL