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 (*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.