Subscribe to an SNS topic and / or SQS queue in golang?
up vote
0
down vote
favorite
I know how to do this in java, but I just can't figure it out in Go at all.
All I want to do, is have a way to detect that an item got created in an S3 bucket, then have that trigger an SNS topic, which then notifies me of the file location in S3.
Has anybody got a working example of how I can do the go side of this for subscribing to the SNS topic or the SNS queue if I need one? Because all I seem to be able to find is Java and Node. I can find publish examples for go, but they are of little use to my use case.
amazon-web-services go amazon-s3 amazon-sqs amazon-sns
add a comment |
up vote
0
down vote
favorite
I know how to do this in java, but I just can't figure it out in Go at all.
All I want to do, is have a way to detect that an item got created in an S3 bucket, then have that trigger an SNS topic, which then notifies me of the file location in S3.
Has anybody got a working example of how I can do the go side of this for subscribing to the SNS topic or the SNS queue if I need one? Because all I seem to be able to find is Java and Node. I can find publish examples for go, but they are of little use to my use case.
amazon-web-services go amazon-s3 amazon-sqs amazon-sns
2
S3 can publish events to SNS when an object gets created with just configuration and no coding. Where is your problem?
– Kannaiyan
Nov 7 at 22:49
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I know how to do this in java, but I just can't figure it out in Go at all.
All I want to do, is have a way to detect that an item got created in an S3 bucket, then have that trigger an SNS topic, which then notifies me of the file location in S3.
Has anybody got a working example of how I can do the go side of this for subscribing to the SNS topic or the SNS queue if I need one? Because all I seem to be able to find is Java and Node. I can find publish examples for go, but they are of little use to my use case.
amazon-web-services go amazon-s3 amazon-sqs amazon-sns
I know how to do this in java, but I just can't figure it out in Go at all.
All I want to do, is have a way to detect that an item got created in an S3 bucket, then have that trigger an SNS topic, which then notifies me of the file location in S3.
Has anybody got a working example of how I can do the go side of this for subscribing to the SNS topic or the SNS queue if I need one? Because all I seem to be able to find is Java and Node. I can find publish examples for go, but they are of little use to my use case.
amazon-web-services go amazon-s3 amazon-sqs amazon-sns
amazon-web-services go amazon-s3 amazon-sqs amazon-sns
asked Nov 7 at 22:41
MickeyThreeSheds
18216
18216
2
S3 can publish events to SNS when an object gets created with just configuration and no coding. Where is your problem?
– Kannaiyan
Nov 7 at 22:49
add a comment |
2
S3 can publish events to SNS when an object gets created with just configuration and no coding. Where is your problem?
– Kannaiyan
Nov 7 at 22:49
2
2
S3 can publish events to SNS when an object gets created with just configuration and no coding. Where is your problem?
– Kannaiyan
Nov 7 at 22:49
S3 can publish events to SNS when an object gets created with just configuration and no coding. Where is your problem?
– Kannaiyan
Nov 7 at 22:49
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
To use SNS you will need a simple HTTP/HTTPS endpoint to receive SNS notifications. Which is divided into two parts (Confirm the subscription and Processing messages from HTTP/HTTPS endpoint)
1. Confirm the subscription
Do something as simple as this:
func confirmSubscription(subcribeURL string) {
response, err := http.Get(subcribeURL)
if err != nil {
fmt.Printf("Unbale to confirm subscriptions")
} else {
fmt.Printf("Subscription Confirmed sucessfully. %d", response.StatusCode)
}
}
2. Processing messages from HTTP/HTTPS endpoint
Parse the request's body, the documentations mentions how the body should be structured.
Sources:
https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
https://github.com/viveksyngh/aws-sns-subscriber/blob/master/subscriber/subscriber.go
Ok! Thanks! But I have one more question! SubscribeURL? I've never seen that before, I am SURE I used ARNs for subscribing before, no?
– MickeyThreeSheds
Nov 8 at 2:17
The SubscribeURL is sent to you in the body during the "confirmation" step. All what you need to do is make a GET request to that URL and you will start receiving messages from SNS as soon as they sent from S3.
– mostafazh
Nov 8 at 7:33
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
To use SNS you will need a simple HTTP/HTTPS endpoint to receive SNS notifications. Which is divided into two parts (Confirm the subscription and Processing messages from HTTP/HTTPS endpoint)
1. Confirm the subscription
Do something as simple as this:
func confirmSubscription(subcribeURL string) {
response, err := http.Get(subcribeURL)
if err != nil {
fmt.Printf("Unbale to confirm subscriptions")
} else {
fmt.Printf("Subscription Confirmed sucessfully. %d", response.StatusCode)
}
}
2. Processing messages from HTTP/HTTPS endpoint
Parse the request's body, the documentations mentions how the body should be structured.
Sources:
https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
https://github.com/viveksyngh/aws-sns-subscriber/blob/master/subscriber/subscriber.go
Ok! Thanks! But I have one more question! SubscribeURL? I've never seen that before, I am SURE I used ARNs for subscribing before, no?
– MickeyThreeSheds
Nov 8 at 2:17
The SubscribeURL is sent to you in the body during the "confirmation" step. All what you need to do is make a GET request to that URL and you will start receiving messages from SNS as soon as they sent from S3.
– mostafazh
Nov 8 at 7:33
add a comment |
up vote
0
down vote
To use SNS you will need a simple HTTP/HTTPS endpoint to receive SNS notifications. Which is divided into two parts (Confirm the subscription and Processing messages from HTTP/HTTPS endpoint)
1. Confirm the subscription
Do something as simple as this:
func confirmSubscription(subcribeURL string) {
response, err := http.Get(subcribeURL)
if err != nil {
fmt.Printf("Unbale to confirm subscriptions")
} else {
fmt.Printf("Subscription Confirmed sucessfully. %d", response.StatusCode)
}
}
2. Processing messages from HTTP/HTTPS endpoint
Parse the request's body, the documentations mentions how the body should be structured.
Sources:
https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
https://github.com/viveksyngh/aws-sns-subscriber/blob/master/subscriber/subscriber.go
Ok! Thanks! But I have one more question! SubscribeURL? I've never seen that before, I am SURE I used ARNs for subscribing before, no?
– MickeyThreeSheds
Nov 8 at 2:17
The SubscribeURL is sent to you in the body during the "confirmation" step. All what you need to do is make a GET request to that URL and you will start receiving messages from SNS as soon as they sent from S3.
– mostafazh
Nov 8 at 7:33
add a comment |
up vote
0
down vote
up vote
0
down vote
To use SNS you will need a simple HTTP/HTTPS endpoint to receive SNS notifications. Which is divided into two parts (Confirm the subscription and Processing messages from HTTP/HTTPS endpoint)
1. Confirm the subscription
Do something as simple as this:
func confirmSubscription(subcribeURL string) {
response, err := http.Get(subcribeURL)
if err != nil {
fmt.Printf("Unbale to confirm subscriptions")
} else {
fmt.Printf("Subscription Confirmed sucessfully. %d", response.StatusCode)
}
}
2. Processing messages from HTTP/HTTPS endpoint
Parse the request's body, the documentations mentions how the body should be structured.
Sources:
https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
https://github.com/viveksyngh/aws-sns-subscriber/blob/master/subscriber/subscriber.go
To use SNS you will need a simple HTTP/HTTPS endpoint to receive SNS notifications. Which is divided into two parts (Confirm the subscription and Processing messages from HTTP/HTTPS endpoint)
1. Confirm the subscription
Do something as simple as this:
func confirmSubscription(subcribeURL string) {
response, err := http.Get(subcribeURL)
if err != nil {
fmt.Printf("Unbale to confirm subscriptions")
} else {
fmt.Printf("Subscription Confirmed sucessfully. %d", response.StatusCode)
}
}
2. Processing messages from HTTP/HTTPS endpoint
Parse the request's body, the documentations mentions how the body should be structured.
Sources:
https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
https://github.com/viveksyngh/aws-sns-subscriber/blob/master/subscriber/subscriber.go
edited Nov 7 at 23:06
answered Nov 7 at 22:58
mostafazh
1,558718
1,558718
Ok! Thanks! But I have one more question! SubscribeURL? I've never seen that before, I am SURE I used ARNs for subscribing before, no?
– MickeyThreeSheds
Nov 8 at 2:17
The SubscribeURL is sent to you in the body during the "confirmation" step. All what you need to do is make a GET request to that URL and you will start receiving messages from SNS as soon as they sent from S3.
– mostafazh
Nov 8 at 7:33
add a comment |
Ok! Thanks! But I have one more question! SubscribeURL? I've never seen that before, I am SURE I used ARNs for subscribing before, no?
– MickeyThreeSheds
Nov 8 at 2:17
The SubscribeURL is sent to you in the body during the "confirmation" step. All what you need to do is make a GET request to that URL and you will start receiving messages from SNS as soon as they sent from S3.
– mostafazh
Nov 8 at 7:33
Ok! Thanks! But I have one more question! SubscribeURL? I've never seen that before, I am SURE I used ARNs for subscribing before, no?
– MickeyThreeSheds
Nov 8 at 2:17
Ok! Thanks! But I have one more question! SubscribeURL? I've never seen that before, I am SURE I used ARNs for subscribing before, no?
– MickeyThreeSheds
Nov 8 at 2:17
The SubscribeURL is sent to you in the body during the "confirmation" step. All what you need to do is make a GET request to that URL and you will start receiving messages from SNS as soon as they sent from S3.
– mostafazh
Nov 8 at 7:33
The SubscribeURL is sent to you in the body during the "confirmation" step. All what you need to do is make a GET request to that URL and you will start receiving messages from SNS as soon as they sent from S3.
– mostafazh
Nov 8 at 7:33
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53199003%2fsubscribe-to-an-sns-topic-and-or-sqs-queue-in-golang%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
S3 can publish events to SNS when an object gets created with just configuration and no coding. Where is your problem?
– Kannaiyan
Nov 7 at 22:49