Documentation
¶
Overview ¶
Package pull is the shared shape of the queue-like transports (Pub/Sub, SQS, Service Bus): a goroutine pulls messages and holds each one's handle, the receive keeps some of them, and when the run ends the kept handles are acknowledged and every other handle is given back to the service.
Skipped messages are held until the end rather than given back at once: an immediate give-back would deliver them to this same run again and again.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
func Collect[H any](ctx context.Context, rc transport.Receive, idOf func(transport.Message) string, pump Pump[H], settle Settle[H]) ([]transport.Message, error)
Collect runs pump, collects the receive, and settles. idOf names a message the way the pump's Hold calls do. The messages kept are returned with any error, including ErrTimeout (the partial list); a settle failure is returned only when nothing else failed.
Goroutine ownership: Collect starts the pump goroutine and waits for it before it settles.
Types ¶
type Book ¶
type Book[H any] struct { // contains filtered or unexported fields }
Book remembers the handle (an ack id, a receipt handle, a received message) of every message pulled, by message id, and which ones were kept. It is safe for the pulling goroutine and the collector to use together.