Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQS Client Issue #310

Open
Rizbe opened this issue Jul 23, 2018 · 4 comments
Open

SQS Client Issue #310

Rizbe opened this issue Jul 23, 2018 · 4 comments

Comments

@Rizbe
Copy link

Rizbe commented Jul 23, 2018

Getting the following error below when trying to use SQS

package main

import (
	"net/http"
	"time"

	"github.com/RichardKnop/machinery/v1/config"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/credentials"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/sqs"
)

var sqsClient = sqs.New(session.Must(session.NewSession(&aws.Config{
	Region:      aws.String("YOUR_AWS_REGION"),
	Credentials: credentials.NewStaticCredentials("YOUR_AWS_ACCESS_KEY", "YOUR_AWS_ACCESS_SECRET", ""),
	HTTPClient: &http.Client{
		Timeout: time.Second * 120,
	},
})))
var visibilityTimeout = 20

func main() {

	cnf := &config.Config{
		Broker:        "YOUR_SQS_URL",
		DefaultQueue:  "machinery_tasks",
		ResultBackend: "YOUR_BACKEND_URL",
		SQS: &config.SQSConfig{
			Client: sqsClient,
			// if VisibilityTimeout is nil default to the overall visibility timeout setting for the queue
			// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
			VisibilityTimeout: &visibilityTimeout,
			WaitTimeSeconds:   30,
		},
	}

}
cannot use sqsClient (type *"github.com/aws/aws-sdk-go/service/sqs".SQS) as type *"github.com/RichardKnop/machinery/vendor/github.com/aws/aws-sdk-go/service/sqs".SQS in field value
@Rizbe
Copy link
Author

Rizbe commented Jul 24, 2018

Removing aws from vendor file seemed to do the trick, saw this issue in the aws-sdk project:
aws/aws-sdk-go#634

@Rizbe
Copy link
Author

Rizbe commented Aug 3, 2018

bump

@koron
Copy link

koron commented Sep 10, 2018

the type of SQSConfig.Client is *sqs.SQS.
but sqs package is vendored by machinery,
so values of *sqs.SQS type won't be injected by library users (out of machinery pacakge).

so current SQSConfig.Client never work for users,
or too hard to make it work.

@dairyo
Copy link

dairyo commented Oct 30, 2018

This issue must be resolved. Now machinery does not vendor sqs package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants