Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoScalingClient ¶
type AutoScalingClient interface {
CompleteLifecycleAction(ctx context.Context, params *autoscaling.CompleteLifecycleActionInput, optFns ...func(*autoscaling.Options)) (*autoscaling.CompleteLifecycleActionOutput, error)
}
AutoScalingClient is an interface around the AWS SDK Auto Scaling client. It contains the operations that are used by LifecycleHookSQSMessageHandler. It is present to aid unit testing.
type LifecycleHookHandler ¶
LifecycleHookHandler is called into by LifecycleHookSQSMessageHandler for every valid lifecycle event message received through SQS. Right now only termination events are forwarded.
func NewBuildQueueLifecycleHookHandler ¶
func NewBuildQueueLifecycleHookHandler(buildQueue buildqueuestate.BuildQueueStateClient, instanceIDLabel string) LifecycleHookHandler
NewBuildQueueLifecycleHookHandler creates a new lifecycle hook handler that forwards EC2 instance termination events to a build queue. This causes the build queue to drain any workers running on this EC2 instance, while ensuring that the EC2 instance is not terminated before existing operations finish.
type SQSClient ¶
type SQSClient interface { ReceiveMessage(ctx context.Context, params *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error) DeleteMessage(ctx context.Context, params *sqs.DeleteMessageInput, optFns ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error) }
SQSClient is an interface around the AWS SDK SQS client. It contains the operations that are used by SQSReceiver. It is present to aid unit testing.
type SQSMessageHandler ¶
SQSMessageHandler provides a callback that is used by SQSReceiver that is invoked for every message that has been received. When this callback returns success, the message is removed from the queue.
func NewLifecycleHookSQSMessageHandler ¶
func NewLifecycleHookSQSMessageHandler(autoScalingClient AutoScalingClient, handler LifecycleHookHandler) SQSMessageHandler
NewLifecycleHookSQSMessageHandler creates an SQSMessageHandler that assumes that messages received through SQS contain events generated by an ASG lifecycle hook. These events may be generated when EC2 instances are added and removed from Auto Scaling Groups (ASGs).
type SQSReceiver ¶
type SQSReceiver struct {
// contains filtered or unexported fields
}
SQSReceiver is a simple client for SQS that receives messages from SQS. Every message is provided to a handler that processes the message in its own goroutine. When the message is handled successfully, it is removed from SQS.
func NewSQSReceiver ¶
func NewSQSReceiver(sqsClient SQSClient, url string, visibilityTimeout time.Duration, messageHandler SQSMessageHandler, errorLogger util.ErrorLogger) *SQSReceiver
NewSQSReceiver creates a new SQSReceiver.
func (*SQSReceiver) PerformSingleRequest ¶
PerformSingleRequest receives a single batch of messages from SQS. This function generally needs to be called in a loop.