ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Queue.Sqs.Internal

Description

The tuning fields, the message lifting and the dead-letter probe behind Ecluse.Runtime.Queue.Sqs, which documents the backend and re-exports the curated surface. Importing this module opts out of that stability promise, the convention text and bytestring use, so production code imports the public one.

Synopsis

Configuration

data SqsConfig Source #

What the SQS backend needs. The provider knobs take their defaults from defaultSqsConfig (see Ecluse.Core.Queue).

Constructors

SqsConfig 

Fields

  • sqsQueueUrl :: Text

    The fully-qualified SQS queue URL mirror jobs are sent to and received from.

  • sqsRegion :: Text

    The AWS region the queue lives in (e.g. "us-east-1").

  • sqsEndpoint :: Maybe AwsEndpoint

    An endpoint override for an emulator or VPC endpoint. Nothing uses amazonka's default resolution and the ambient credential chain.

  • sqsBatchSize :: Int

    Maximum messages to pull per receive (SQS caps this at 10).

  • sqsWaitSeconds :: Int

    The long-poll window in seconds (SQS caps this at 20). A receive waits this long for a message before returning [], so an idle worker does not hot-loop on empty polls.

  • sqsVisibilityTimeout :: Seconds

    How long a received message stays hidden before SQS redelivers it: the budget for processing-then-ack, extendable per message via extendVisibility.

  • sqsTerminalBackoff :: Seconds

    The visibility timeout deadLetter applies to a terminal message. It exceeds the processing window, so the worker does not re-fetch an unmirrorable artifact in a hot loop.

  • sqsMaxReceiveCount :: DeliveryBudget

    The configured floor on deliveries before the worker retires a message. newSqsQueue raises the budget past a redrive policy's count, so it never pre-empts a dead-letter capture.

Instances

Instances details
Show SqsConfig Source # 
Instance details

Defined in Ecluse.Runtime.Queue.Sqs.Internal

Eq SqsConfig Source # 
Instance details

Defined in Ecluse.Runtime.Queue.Sqs.Internal

defaultSqsConfig :: Text -> Text -> SqsConfig Source #

A SqsConfig for a queue URL and region, with the provider knobs at their defaults.

The backend

newSqsQueue :: LogEnv -> (Text -> Either Text RegistryUrl) -> SqsConfig -> IO MirrorQueue Source #

Build an SQS-backed MirrorQueue. The amazonka Env is built once here and the returned handle's closures capture it.

Received-message lifting

data ReceivedMessage Source #

The fields of a received SQS message the backend reads. Lifting them out of the amazonka Message keeps the QueueMessage mapping free of the AWS type.

Constructors

ReceivedMessage 

Fields

  • rmBody :: Maybe Text

    The message body carrying the encoded job (SQS always supplies one).

  • rmReceipt :: Maybe Text

    The receipt handle a later ack deletes the message by (SQS always supplies one).

  • rmMessageId :: Maybe Text

    The SQS-assigned message id, for the drop log. Not part of the untrusted body.

  • rmReceiveCount :: Maybe Text

    The raw ApproximateReceiveCount system attribute, which the poll asks for explicitly. Nothing when SQS supplied none, which reads as a first delivery.

liftReceivedMessages :: LogEnv -> (Text -> Either Text RegistryUrl) -> ReceiptLease -> [ReceivedMessage] -> IO [QueueMessage] Source #

Lift a received batch into deliverable QueueMessages under one poll's lease. A drop is logged, omitted, and left un-acked, so redelivery and dead-letter behaviour are unchanged.

Dead-letter probe

deadLetterTerminusOf :: Maybe Text -> DeadLetterTerminus Source #

Classify a queue's raw RedrivePolicy into its dead-letter terminus. No policy or a blank one is absent, and any other is attached, with maxReceiveCount only when it reads.

The queue payload's wire-name gate

mirrorJobPackage :: Ecosystem -> Maybe Text -> Text -> Either Text PackageName Source #

Read a queue payload's package identity through its ecosystem's own grammar, the gate decodeJob applies at the trust boundary. Only npm has one to read it through.