Documentation ¶
Index ¶
- func GenerateQueueRecord(rnd *rand.Rand) (models.Record, error)
- func NewRecord(id uuid.UUID, messageID string, receipt models.Receipt, body []byte, ...) models.Record
- func NewTransaction() models.Transaction
- type Config
- type ConfigOption
- func WithEC2Role(ec2Role bool) ConfigOption
- func WithID(id string) ConfigOption
- func WithMaxNumberOfMessages(numOfMessages int64) ConfigOption
- func WithQueue(queue string) ConfigOption
- func WithRegion(region string) ConfigOption
- func WithSecret(secret string) ConfigOption
- func WithToken(token string) ConfigOption
- func WithVisibilityTimeout(visibilityTimeout time.Duration) ConfigOption
- type Option
- type Queue
- type RemoteConfig
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateQueueRecord ¶
GenerateQueueRecord creates a new queue record
func NewRecord ¶
func NewRecord(id uuid.UUID, messageID string, receipt models.Receipt, body []byte, receivedAt time.Time, ) models.Record
NewRecord is a default queue record implementation
func NewTransaction ¶
func NewTransaction() models.Transaction
NewTransaction creates a very simplistic models transaction
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config encapsulates the requirements for generating a Queue
type ConfigOption ¶
type ConfigOption func(*RemoteConfig) error
ConfigOption defines a option for generating a RemoteConfig
func WithEC2Role ¶
func WithEC2Role(ec2Role bool) ConfigOption
WithEC2Role adds an EC2Role option to the configuration
func WithMaxNumberOfMessages ¶
func WithMaxNumberOfMessages(numOfMessages int64) ConfigOption
WithMaxNumberOfMessages adds an MaxNumberOfMessages option to the configuration
func WithQueue ¶
func WithQueue(queue string) ConfigOption
WithQueue adds an Queue option to the configuration
func WithRegion ¶
func WithRegion(region string) ConfigOption
WithRegion adds an Region option to the configuration
func WithSecret ¶
func WithSecret(secret string) ConfigOption
WithSecret adds an Secret option to the configuration
func WithToken ¶
func WithToken(token string) ConfigOption
WithToken adds an Token option to the configuration
func WithVisibilityTimeout ¶
func WithVisibilityTimeout(visibilityTimeout time.Duration) ConfigOption
WithVisibilityTimeout adds an VisibilityTimeout option to the configuration
type Option ¶
Option defines a option for generating a queue Config
func WithConfig ¶
func WithConfig(remoteConfig *RemoteConfig) Option
WithConfig adds a remote queue config to the configuration
type Queue ¶
type Queue interface { // Enqueue a record Enqueue(models.Record) error // Dequeue a record from the channel Dequeue() ([]models.Record, error) // Commit a transaction containing the records, so that an ack can be sent Commit(models.Transaction) (Result, error) // Failed a transaction containing the records, so that potential retries can // be used. Failed(models.Transaction) (Result, error) }
Queue represents a series of records The queue's underlying backing store is a constructed from a channel, so it blocks if no body dequeues any items.
type RemoteConfig ¶
type RemoteConfig struct { EC2Role bool ID, Secret, Token string Region, Queue string MaxNumberOfMessages int64 VisibilityTimeout time.Duration }
RemoteConfig creates a configuration to create a RemoteQueue.
func BuildConfig ¶
func BuildConfig(opts ...ConfigOption) (*RemoteConfig, error)
BuildConfig ingests configuration options to then yield a RemoteConfig, and return an error if it fails during configuring.