sqsdrain

package module
v0.0.0-...-b8f7e3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2014 License: MIT Imports: 4 Imported by: 0

README

sqsdrain

sqsdrain is a Go package that removes all messages from an SQS queue. It's incredibly useful for test environments where purging a queue is necessary.

Installation

Run the following command from your terminal:

go get github.com/anandkunal/sqsdrain

This package requires goamz, particularly the repository managed by CrowdMob. You can get that dependency by executing the following terminal commands:

go get github.com/crowdmob/goamz/aws
go get github.com/crowdmob/goamz/sqs

Example

Go ahead and couch the following into an example.go.

package main

import (
  "time"

  "github.com/anandkunal/sqsdrain"
  "github.com/crowdmob/goamz/aws"
)

var (
  accessKey  = "access key goes here"
  secretKey  = "secret key goes here"
  region     = aws.USWest2
  queueName  = "queue-name-goes-here"
  sleep      = time.Second * 5
  runForever = true
)

func main() {
  sqsdrain.Drain(accessKey, secretKey, region, queueName, sleep, runForever)
}

You can run the above with a simple go run example.go. You should see output like:

2014/03/07 21:37:59 sqsdrain: connected to queue: https://sqs.us-west-2.amazonaws.com/48239042/queue-name-goes-here
2014/03/07 21:37:59 sqsdrain: dequeued 0 messages
2014/03/07 21:38:05 sqsdrain: dequeued 4 message
2014/03/07 21:38:10 sqsdrain: dequeued 0 messages

Contributions

sqsdrain was developed by Kunal Anand and is completely free. Have fun.

Documentation

Index

Constants

View Source
const (
	MAX_SQS_MESSAGES = 10
)

Variables

This section is empty.

Functions

func Drain

func Drain(accessKey string, secretKey string, region aws.Region, queueName string, sleep time.Duration, runForever bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL