Documentation
¶
Overview ¶
Package mq provides a Starlark module for unified message queue operations. It supports AWS SQS and Azure Service Bus with a consistent API.
Index ¶
- Constants
- Variables
- func IsRetryableError(err error) bool
- func IsTemporaryError(err error) bool
- func NormalizeError(service, operation string, err error) error
- type AWSSQSClient
- func (c *AWSSQSClient) BatchSend(ctx context.Context, queueName string, messages []BatchMessage) ([]*MessageResult, error)
- func (c *AWSSQSClient) Cancel(ctx context.Context, queueName, messageID string) error
- func (c *AWSSQSClient) Close() error
- func (c *AWSSQSClient) CreateQueue(ctx context.Context, name string, options QueueOptions) (*Queue, error)
- func (c *AWSSQSClient) DeadLetterPurge(ctx context.Context, queueName string) error
- func (c *AWSSQSClient) DeadLetterReceive(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
- func (c *AWSSQSClient) DeadLetterRequeue(ctx context.Context, queueName, messageID string) error
- func (c *AWSSQSClient) Delete(ctx context.Context, queueName string, messageIDs []string) ([]bool, error)
- func (c *AWSSQSClient) DeleteQueue(ctx context.Context, name string) error
- func (c *AWSSQSClient) Exists(ctx context.Context, name string) (bool, error)
- func (c *AWSSQSClient) GetClientInfo() map[string]interface{}
- func (c *AWSSQSClient) GetInfo(ctx context.Context, name string) (*Queue, error)
- func (c *AWSSQSClient) GetQueue(ctx context.Context, name string) (*Queue, error)
- func (c *AWSSQSClient) ListQueues(ctx context.Context, prefix string) ([]*Queue, error)
- func (c *AWSSQSClient) Lock(ctx context.Context, queueName, messageID string, duration int) error
- func (c *AWSSQSClient) Peek(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
- func (c *AWSSQSClient) Purge(ctx context.Context, name string) error
- func (c *AWSSQSClient) Receive(ctx context.Context, queueName string, options ReceiveOptions) ([]*MessageResult, error)
- func (c *AWSSQSClient) Schedule(ctx context.Context, queueName, body string, scheduledTime time.Time, ...) (*MessageResult, error)
- func (c *AWSSQSClient) Send(ctx context.Context, queueName, body string, options MessageOptions) (*MessageResult, error)
- func (c *AWSSQSClient) Unlock(ctx context.Context, queueName, messageID string) error
- type AzureServiceBusClient
- func (c *AzureServiceBusClient) AbandonMessage(ctx context.Context, queueName string, msgResult *MessageResult) error
- func (c *AzureServiceBusClient) BatchSend(ctx context.Context, queueName string, messages []BatchMessage) ([]*MessageResult, error)
- func (c *AzureServiceBusClient) Cancel(ctx context.Context, queueName, messageID string) error
- func (c *AzureServiceBusClient) Close() error
- func (c *AzureServiceBusClient) CompleteMessage(ctx context.Context, queueName string, msgResult *MessageResult) error
- func (c *AzureServiceBusClient) CreateQueue(ctx context.Context, name string, options QueueOptions) (*Queue, error)
- func (c *AzureServiceBusClient) DeadLetterPurge(ctx context.Context, queueName string) error
- func (c *AzureServiceBusClient) DeadLetterReceive(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
- func (c *AzureServiceBusClient) DeadLetterRequeue(ctx context.Context, queueName, messageID string) error
- func (c *AzureServiceBusClient) Delete(ctx context.Context, queueName string, messageIDs []string) ([]bool, error)
- func (c *AzureServiceBusClient) DeleteQueue(ctx context.Context, name string) error
- func (c *AzureServiceBusClient) Exists(ctx context.Context, name string) (bool, error)
- func (c *AzureServiceBusClient) GetClientInfo() map[string]interface{}
- func (c *AzureServiceBusClient) GetInfo(ctx context.Context, name string) (*Queue, error)
- func (c *AzureServiceBusClient) GetQueue(ctx context.Context, name string) (*Queue, error)
- func (c *AzureServiceBusClient) ListQueues(ctx context.Context, prefix string) ([]*Queue, error)
- func (c *AzureServiceBusClient) Lock(ctx context.Context, queueName, messageID string, duration int) error
- func (c *AzureServiceBusClient) Peek(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
- func (c *AzureServiceBusClient) Purge(ctx context.Context, name string) error
- func (c *AzureServiceBusClient) Receive(ctx context.Context, queueName string, options ReceiveOptions) ([]*MessageResult, error)
- func (c *AzureServiceBusClient) RenewMessageLock(ctx context.Context, queueName string, msgResult *MessageResult) error
- func (c *AzureServiceBusClient) Schedule(ctx context.Context, queueName, body string, scheduledTime time.Time, ...) (*MessageResult, error)
- func (c *AzureServiceBusClient) Send(ctx context.Context, queueName, body string, options MessageOptions) (*MessageResult, error)
- func (c *AzureServiceBusClient) Unlock(ctx context.Context, queueName, messageID string) error
- type BatchMessage
- type Client
- type ClientConfig
- type ClientWrapper
- func (cw *ClientWrapper) Attr(name string) (starlark.Value, error)
- func (cw *ClientWrapper) AttrNames() []string
- func (cw *ClientWrapper) Freeze()
- func (cw *ClientWrapper) Hash() (uint32, error)
- func (cw *ClientWrapper) String() string
- func (cw *ClientWrapper) Truth() starlark.Bool
- func (cw *ClientWrapper) Type() string
- type DeadLetterConfig
- type DuplicateDetection
- type ErrorType
- type MQError
- type MessageOptions
- type MessageResult
- type Module
- type Queue
- func (q *Queue) Copy() *Queue
- func (q *Queue) FromStarlark(val starlark.Value) error
- func (q *Queue) GetLockDuration() time.Duration
- func (q *Queue) GetRetentionPeriod() time.Duration
- func (q *Queue) IsDeadLetterEnabled() bool
- func (q *Queue) IsDuplicateDetectionEnabled() bool
- func (q *Queue) Struct() (starlark.Value, error)
- type QueueOptions
- type ReceiveOptions
Constants ¶
const ( ServiceTypeAWSSQS = "aws_sqs" ServiceTypeAzureServiceBus = "azure_servicebus" ServiceTypeAuto = "auto" )
Service type constants
const ModuleName = "mq"
ModuleName defines the expected name for this module when used in Starlark's load() function
Variables ¶
var ( // ErrQueueNotFound indicates that the specified queue does not exist ErrQueueNotFound = errors.New("queue not found") // ErrQueueAlreadyExists indicates that the queue already exists ErrQueueAlreadyExists = errors.New("queue already exists") // ErrMessageNotFound indicates that the specified message does not exist ErrMessageNotFound = errors.New("message not found") // ErrMessageTooLarge indicates that the message exceeds size limits ErrMessageTooLarge = errors.New("message too large") // ErrAccessDenied indicates insufficient permissions ErrAccessDenied = errors.New("access denied") // ErrThrottled indicates that the request was throttled ErrThrottled = errors.New("request throttled") ErrServiceUnavailable = errors.New("service unavailable") // ErrInvalidParameter indicates invalid parameter values ErrInvalidParameter = errors.New("invalid parameter") // ErrUnsupportedOperation indicates that the operation is not supported by the service ErrUnsupportedOperation = errors.New("unsupported operation") // ErrConnectionFailed indicates that connection to the service failed ErrConnectionFailed = errors.New("connection failed") // ErrTimeout indicates that the operation timed out ErrTimeout = errors.New("operation timed out") )
Common error types for unified error handling across services
Functions ¶
func IsRetryableError ¶
IsRetryableError determines if an error is retryable
func IsTemporaryError ¶
IsTemporaryError determines if an error is temporary
func NormalizeError ¶
NormalizeError converts service-specific errors to unified MQError types
Types ¶
type AWSSQSClient ¶
type AWSSQSClient struct {
// contains filtered or unexported fields
}
AWSSQSClient implements the Client interface for AWS SQS
func (*AWSSQSClient) BatchSend ¶
func (c *AWSSQSClient) BatchSend(ctx context.Context, queueName string, messages []BatchMessage) ([]*MessageResult, error)
BatchSend sends multiple messages in batches
func (*AWSSQSClient) Cancel ¶
func (c *AWSSQSClient) Cancel(ctx context.Context, queueName, messageID string) error
Cancel cancels a scheduled message (not supported by SQS)
func (*AWSSQSClient) Close ¶
func (c *AWSSQSClient) Close() error
Close closes the client connection
func (*AWSSQSClient) CreateQueue ¶
func (c *AWSSQSClient) CreateQueue(ctx context.Context, name string, options QueueOptions) (*Queue, error)
CreateQueue creates a new SQS queue
func (*AWSSQSClient) DeadLetterPurge ¶
func (c *AWSSQSClient) DeadLetterPurge(ctx context.Context, queueName string) error
DeadLetterPurge purges all messages from the dead letter queue
func (*AWSSQSClient) DeadLetterReceive ¶
func (c *AWSSQSClient) DeadLetterReceive(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
DeadLetterReceive receives messages from the dead letter queue
func (*AWSSQSClient) DeadLetterRequeue ¶
func (c *AWSSQSClient) DeadLetterRequeue(ctx context.Context, queueName, messageID string) error
DeadLetterRequeue moves a message back from DLQ to main queue
func (*AWSSQSClient) Delete ¶
func (c *AWSSQSClient) Delete(ctx context.Context, queueName string, messageIDs []string) ([]bool, error)
Delete deletes messages from a queue
func (*AWSSQSClient) DeleteQueue ¶
func (c *AWSSQSClient) DeleteQueue(ctx context.Context, name string) error
DeleteQueue deletes an SQS queue
func (*AWSSQSClient) GetClientInfo ¶
func (c *AWSSQSClient) GetClientInfo() map[string]interface{}
GetClientInfo returns information about the client
func (*AWSSQSClient) ListQueues ¶
ListQueues lists SQS queues
func (*AWSSQSClient) Peek ¶
func (c *AWSSQSClient) Peek(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
Peek peeks at messages without receiving them (not supported by SQS)
func (*AWSSQSClient) Purge ¶
func (c *AWSSQSClient) Purge(ctx context.Context, name string) error
Purge purges all messages from a queue
func (*AWSSQSClient) Receive ¶
func (c *AWSSQSClient) Receive(ctx context.Context, queueName string, options ReceiveOptions) ([]*MessageResult, error)
Receive receives messages from a queue
func (*AWSSQSClient) Schedule ¶
func (c *AWSSQSClient) Schedule(ctx context.Context, queueName, body string, scheduledTime time.Time, options MessageOptions) (*MessageResult, error)
Schedule schedules a message for future delivery
func (*AWSSQSClient) Send ¶
func (c *AWSSQSClient) Send(ctx context.Context, queueName, body string, options MessageOptions) (*MessageResult, error)
Send sends a message to a queue
type AzureServiceBusClient ¶
type AzureServiceBusClient struct {
// contains filtered or unexported fields
}
AzureServiceBusClient implements the Client interface for Azure Service Bus
func (*AzureServiceBusClient) AbandonMessage ¶
func (c *AzureServiceBusClient) AbandonMessage(ctx context.Context, queueName string, msgResult *MessageResult) error
AbandonMessage abandons a message using the original Azure ReceivedMessage
func (*AzureServiceBusClient) BatchSend ¶
func (c *AzureServiceBusClient) BatchSend(ctx context.Context, queueName string, messages []BatchMessage) ([]*MessageResult, error)
BatchSend sends multiple messages in batches
func (*AzureServiceBusClient) Cancel ¶
func (c *AzureServiceBusClient) Cancel(ctx context.Context, queueName, messageID string) error
Cancel cancels a scheduled message
func (*AzureServiceBusClient) Close ¶
func (c *AzureServiceBusClient) Close() error
Close closes the client connection
func (*AzureServiceBusClient) CompleteMessage ¶
func (c *AzureServiceBusClient) CompleteMessage(ctx context.Context, queueName string, msgResult *MessageResult) error
CompleteMessage completes a message using the original Azure ReceivedMessage
func (*AzureServiceBusClient) CreateQueue ¶
func (c *AzureServiceBusClient) CreateQueue(ctx context.Context, name string, options QueueOptions) (*Queue, error)
CreateQueue creates a new Service Bus queue using admin client
func (*AzureServiceBusClient) DeadLetterPurge ¶
func (c *AzureServiceBusClient) DeadLetterPurge(ctx context.Context, queueName string) error
DeadLetterPurge purges all messages from the dead letter queue
func (*AzureServiceBusClient) DeadLetterReceive ¶
func (c *AzureServiceBusClient) DeadLetterReceive(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
DeadLetterReceive receives messages from the dead letter queue
func (*AzureServiceBusClient) DeadLetterRequeue ¶
func (c *AzureServiceBusClient) DeadLetterRequeue(ctx context.Context, queueName, messageID string) error
DeadLetterRequeue moves a message back from DLQ to main queue
func (*AzureServiceBusClient) Delete ¶
func (c *AzureServiceBusClient) Delete(ctx context.Context, queueName string, messageIDs []string) ([]bool, error)
Delete deletes messages from a queue (completes them in Service Bus terms)
func (*AzureServiceBusClient) DeleteQueue ¶
func (c *AzureServiceBusClient) DeleteQueue(ctx context.Context, name string) error
DeleteQueue deletes a Service Bus queue
func (*AzureServiceBusClient) GetClientInfo ¶
func (c *AzureServiceBusClient) GetClientInfo() map[string]interface{}
GetClientInfo returns information about the client
func (*AzureServiceBusClient) ListQueues ¶
ListQueues lists Service Bus queues using admin client
func (*AzureServiceBusClient) Lock ¶
func (c *AzureServiceBusClient) Lock(ctx context.Context, queueName, messageID string, duration int) error
Lock renews the lock on a message
func (*AzureServiceBusClient) Peek ¶
func (c *AzureServiceBusClient) Peek(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
Peek peeks at messages without receiving them
func (*AzureServiceBusClient) Purge ¶
func (c *AzureServiceBusClient) Purge(ctx context.Context, name string) error
Purge purges all messages from a queue
func (*AzureServiceBusClient) Receive ¶
func (c *AzureServiceBusClient) Receive(ctx context.Context, queueName string, options ReceiveOptions) ([]*MessageResult, error)
Receive receives messages from a queue
func (*AzureServiceBusClient) RenewMessageLock ¶
func (c *AzureServiceBusClient) RenewMessageLock(ctx context.Context, queueName string, msgResult *MessageResult) error
RenewMessageLock renews the lock on a message using the original Azure ReceivedMessage
func (*AzureServiceBusClient) Schedule ¶
func (c *AzureServiceBusClient) Schedule(ctx context.Context, queueName, body string, scheduledTime time.Time, options MessageOptions) (*MessageResult, error)
Schedule schedules a message for future delivery
func (*AzureServiceBusClient) Send ¶
func (c *AzureServiceBusClient) Send(ctx context.Context, queueName, body string, options MessageOptions) (*MessageResult, error)
Send sends a message to a queue
type BatchMessage ¶
type BatchMessage struct {
Body string // Message body
Properties map[string]interface{} // Message properties
SessionID string // Session ID
CorrelationID string // Correlation ID
ReplyTo string // Reply to queue
TimeToLive int // TTL in seconds
MessageID string // Message ID
ScheduledTime *time.Time // Scheduled delivery time
}
BatchMessage represents a message for batch sending
type Client ¶
type Client interface {
// Queue operations
CreateQueue(ctx context.Context, name string, options QueueOptions) (*Queue, error)
DeleteQueue(ctx context.Context, name string) error
ListQueues(ctx context.Context, prefix string) ([]*Queue, error)
GetQueue(ctx context.Context, name string) (*Queue, error)
Exists(ctx context.Context, name string) (bool, error)
Purge(ctx context.Context, name string) error
GetInfo(ctx context.Context, name string) (*Queue, error)
// Message operations
Send(ctx context.Context, queueName, body string, options MessageOptions) (*MessageResult, error)
Receive(ctx context.Context, queueName string, options ReceiveOptions) ([]*MessageResult, error)
Delete(ctx context.Context, queueName string, messageIDs []string) ([]bool, error)
// Message lock management
Lock(ctx context.Context, queueName, messageID string, duration int) error
Unlock(ctx context.Context, queueName, messageID string) error
// Batch operations
BatchSend(ctx context.Context, queueName string, messages []BatchMessage) ([]*MessageResult, error)
// Specialized message operations
Schedule(ctx context.Context, queueName, body string, scheduledTime time.Time, options MessageOptions) (*MessageResult, error)
Cancel(ctx context.Context, queueName, messageID string) error
Peek(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
// Dead letter queue operations
DeadLetterReceive(ctx context.Context, queueName string, maxCount int) ([]*MessageResult, error)
DeadLetterRequeue(ctx context.Context, queueName, messageID string) error
DeadLetterPurge(ctx context.Context, queueName string) error
// Connection management
Close() error
GetClientInfo() map[string]interface{}
}
Client interface defines the unified operations for message queue services
func NewAWSSQSClient ¶
func NewAWSSQSClient(ctx context.Context, config *ClientConfig) (Client, error)
NewAWSSQSClient creates a new AWS SQS client
func NewAzureServiceBusClient ¶
func NewAzureServiceBusClient(ctx context.Context, config *ClientConfig) (Client, error)
NewAzureServiceBusClient creates a new Azure Service Bus client
type ClientConfig ¶
type ClientConfig struct {
// Service configuration
ServiceType string // Service type (aws_sqs, azure_servicebus, auto)
ConnectionString string // Azure Service Bus connection string
// AWS specific configuration
AWSRegion string // AWS region
AWSAccessKey string // AWS access key ID
AWSSecretKey string // AWS secret access key
AWSSessionToken string // AWS session token
// Connection and performance settings
Timeout int // Connection timeout in seconds
MaxRetries int // Maximum retry attempts
// Default operation settings
DefaultLockDuration int // Default message lock duration in seconds
DefaultBatchSize int // Default batch size for operations
}
ClientConfig contains configuration for a message queue client
func (*ClientConfig) Copy ¶
func (c *ClientConfig) Copy() *ClientConfig
Copy creates a copy of the configuration
func (*ClientConfig) GetDefaultLockDuration ¶
func (c *ClientConfig) GetDefaultLockDuration() time.Duration
GetDefaultLockDuration returns the default lock duration as a time.Duration
func (*ClientConfig) GetTimeout ¶
func (c *ClientConfig) GetTimeout() time.Duration
GetTimeout returns the timeout as a time.Duration
func (*ClientConfig) Validate ¶
func (c *ClientConfig) Validate() error
Validate validates the configuration
type ClientWrapper ¶
type ClientWrapper struct {
// contains filtered or unexported fields
}
ClientWrapper wraps the message queue client for Starlark
func NewClientWrapper ¶
func NewClientWrapper(client Client) *ClientWrapper
NewClientWrapper creates a new ClientWrapper with initialized method maps
func (*ClientWrapper) Attr ¶
func (cw *ClientWrapper) Attr(name string) (starlark.Value, error)
Implement starlark.HasAttrs interface
func (*ClientWrapper) AttrNames ¶
func (cw *ClientWrapper) AttrNames() []string
func (*ClientWrapper) Freeze ¶
func (cw *ClientWrapper) Freeze()
func (*ClientWrapper) Hash ¶
func (cw *ClientWrapper) Hash() (uint32, error)
func (*ClientWrapper) String ¶
func (cw *ClientWrapper) String() string
Implement starlark.Value interface
func (*ClientWrapper) Truth ¶
func (cw *ClientWrapper) Truth() starlark.Bool
func (*ClientWrapper) Type ¶
func (cw *ClientWrapper) Type() string
type DeadLetterConfig ¶
type DeadLetterConfig struct {
Enabled bool // Whether DLQ is enabled
QueueName string // Dead letter queue name
MaxDeliveryCount int // Maximum delivery count before moving to DLQ
}
DeadLetterConfig contains dead letter queue configuration
type DuplicateDetection ¶
type DuplicateDetection struct {
Enabled bool `json:"enabled"`
WindowSeconds int `json:"window_seconds"` // Deduplication window in seconds
}
DuplicateDetection represents duplicate detection configuration
type ErrorType ¶
type ErrorType string
ErrorType categorizes different types of errors
const ( ErrorTypeNotFound ErrorType = "not_found" ErrorTypeAlreadyExists ErrorType = "already_exists" ErrorTypePermission ErrorType = "permission" ErrorTypeThrottling ErrorType = "throttling" ErrorTypeValidation ErrorType = "validation" ErrorTypeConnection ErrorType = "connection" ErrorTypeTimeout ErrorType = "timeout" ErrorTypeService ErrorType = "service" ErrorTypeUnsupported ErrorType = "unsupported" ErrorTypeUnknown ErrorType = "unknown" )
type MQError ¶
type MQError struct {
// Type categorizes the error
Type ErrorType
// Message provides a human-readable description
Message string
// Service indicates which service reported the error
Service string
// Operation indicates which operation failed
Operation string
// Underlying error from the service
Err error
// Additional context
Context map[string]interface{}
}
MQError represents a message queue operation error with additional context
func NewMQError ¶
NewMQError creates a new MQError
func (*MQError) WithContext ¶
WithContext adds context to the error
type MessageOptions ¶
type MessageOptions struct {
// Message properties and metadata
Properties map[string]interface{} // Message properties/attributes
// Message scheduling
ScheduledTime *time.Time // When message should become available for processing
// Message grouping and correlation
SessionID string // Session ID for ordered processing
CorrelationID string // Correlation ID for request tracking
ReplyTo string // Response destination queue
// Message lifecycle
TimeToLive int // Message TTL in seconds
MessageID string // Message ID for deduplication
}
MessageOptions contains options for sending messages
type MessageResult ¶
type MessageResult struct {
// Message identification
MessageID string `json:"message_id"`
Body string `json:"body"`
// Message metadata and properties
Properties map[string]interface{} `json:"properties"`
// Message grouping and correlation
SessionID string `json:"session_id"`
CorrelationID string `json:"correlation_id"`
ReplyTo string `json:"reply_to"`
// Timing information
EnqueueTime time.Time `json:"enqueue_time"`
ScheduledTime *time.Time `json:"scheduled_time,omitempty"`
LockExpiresAt *time.Time `json:"lock_expires_at,omitempty"`
// Delivery information
DeliveryCount int `json:"delivery_count"`
TimeToLive int `json:"time_to_live"` // TTL in seconds
// Service-specific information (internal use)
ReceiptHandle string `json:"receipt_handle"` // Service-specific handle for acknowledgment
OriginalMessage interface{} `json:"-"` // Original service-specific message object (not serialized)
// Operation result
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
MessageResult represents a message received from or sent to a queue
func NewMessageResult ¶
func NewMessageResult(messageID, body string) *MessageResult
NewMessageResult creates a new MessageResult with basic information
func (*MessageResult) IsExpired ¶
func (m *MessageResult) IsExpired() bool
IsExpired checks if the message lock has expired
func (*MessageResult) IsScheduled ¶
func (m *MessageResult) IsScheduled() bool
IsScheduled checks if the message is scheduled for future delivery
func (*MessageResult) Struct ¶
func (m *MessageResult) Struct() (starlark.Value, error)
Struct converts MessageResult to a Starlark dict value for compatibility
func (*MessageResult) TimeUntilExpiry ¶
func (m *MessageResult) TimeUntilExpiry() time.Duration
TimeUntilExpiry returns the duration until the message lock expires
func (*MessageResult) TimeUntilScheduled ¶
func (m *MessageResult) TimeUntilScheduled() time.Duration
TimeUntilScheduled returns the duration until the message becomes available
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module wraps the ConfigurableModule with specific functionality for MQ operations
func NewModule ¶
func NewModule() *Module
NewModule creates a new instance of Module with default configurations
func (*Module) LoadModule ¶
func (m *Module) LoadModule() starlet.ModuleLoader
LoadModule returns the Starlark module loader with MQ-specific functions
type Queue ¶
type Queue struct {
// Basic queue information
Name string `json:"name"`
ServiceType string `json:"service_type"` // Which service backs this queue
URL string `json:"url"` // Service-specific queue URL/identifier
// Queue statistics
MessageCount int `json:"message_count"`
// Queue configuration (unified across services)
LockDuration int `json:"lock_duration"` // Message lock duration in seconds
RetentionPeriod int `json:"retention_period"` // Message retention in seconds
// Dead letter queue configuration
MaxDeliveryCount int `json:"max_delivery_count"`
DeadLetterConfig *DeadLetterConfig `json:"dead_letter_config"`
// Message ordering and deduplication
EnableSessions bool `json:"enable_sessions"` // Ordered processing support
DuplicateDetection *DuplicateDetection `json:"duplicate_detection"` // Deduplication configuration
// Queue limits
MaxQueueSize int64 `json:"max_queue_size"` // Queue size in bytes (-1 for unlimited)
// Timestamps
CreatedTime time.Time `json:"created_time"`
ModifiedTime time.Time `json:"modified_time"`
}
Queue represents a message queue with unified properties across services
func (*Queue) FromStarlark ¶
FromStarlark populates Queue from a Starlark value
func (*Queue) GetLockDuration ¶
GetLockDuration returns the lock duration as a time.Duration
func (*Queue) GetRetentionPeriod ¶
GetRetentionPeriod returns the retention period as a time.Duration
func (*Queue) IsDeadLetterEnabled ¶
IsDeadLetterEnabled checks if dead letter queue is enabled
func (*Queue) IsDuplicateDetectionEnabled ¶
IsDuplicateDetectionEnabled checks if duplicate detection is enabled
type QueueOptions ¶
type QueueOptions struct {
// Lock duration for messages (unified visibility timeout/lock duration)
LockDuration int // Message lock duration in seconds
// Message retention settings
RetentionPeriod int // Message retention period in seconds
// Dead letter queue configuration
MaxDeliveryCount int // Maximum delivery attempts before moving to DLQ
DeadLetterConfig *DeadLetterConfig // Dead letter queue configuration
// Message ordering and deduplication
EnableSessions bool // Enable sessions for message ordering (Azure) or FIFO (AWS)
DuplicateDetection bool // Enable duplicate message detection
DuplicateWindowSecs int // Duplicate detection window in seconds
// Queue size limits
MaxQueueSize int64 // Maximum queue size in bytes (-1 for unlimited)
}
QueueOptions contains options for creating or configuring a queue
type ReceiveOptions ¶
type ReceiveOptions struct {
// Receive behavior
MaxCount int // Maximum number of messages to receive
WaitTime int // Long polling wait time in seconds
PeekOnly bool // Peek messages without receiving them
// Message lock settings
LockDuration *int // Override default lock duration
}
ReceiveOptions contains options for receiving messages