aws-go-sqs

module
v1.0.0-...-a2d72f2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2016 License: MIT

README

aws-go-sqs

GoDoc Build Status MIT License

aws-go-sqs is a SQS library built with aws/aws-sdk-go.

Status

Since I've add API that I needed to this library, it is not completed but still useful.

Example

See more examples in GoDoc.

import (
	"log"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/sqs"

	"github.com/nabeken/aws-go-sqs/queue"
	"github.com/nabeken/aws-go-sqs/queue/option"
)

// Create SQS instance
s := sqs.New(&aws.Config{Region: aws.String("ap-northeast-1")})

// Create Queue instance
q, err := queue.New(s, "example-queue-name")
if err != nil {
    log.Fatal(err)
}

// MessageAttributes
attrs := map[string]interface{}{
    "ATTR1": "STRING!!",
    "ATTR2": 12345,
}

if err := q.SendMessage("MESSAGE BODY", option.MessageAttributes(attrs)); err != nil {
    log.Fatal(err)
}

log.Print("successed!")

Testing

I've add some integration tests in queue/queue_test.go.

If you want to run the tests, you MUST create a decicated queue for the tests. The test suite issues PurgeQueue in teardown.

You can specify the name in environment variable.

$ cd queue
$ export TEST_SQS_QUEUE_NAME=aws-go-sqs-test
$ go test -v -tags debug

If you specify a debug tag, you get all HTTP request and response in stdout.

Directories

Path Synopsis
Package queue provides SQS queue manipulations on the top of stripe/aws-go.
Package queue provides SQS queue manipulations on the top of stripe/aws-go.
option
Package option provides adapters to change a parameter in SQS request.
Package option provides adapters to change a parameter in SQS request.

Jump to

Keyboard shortcuts

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