-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added OptFns to sns/sqs and extra logs
- Loading branch information
1 parent
bcd0160
commit 8cf4b95
Showing
11 changed files
with
233 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package sns | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/aws-sdk-go-v2/service/sns" | ||
"github.com/aws/smithy-go/endpoints" | ||
) | ||
|
||
// OverrideEndpointResolver is a custom endpoint resolver that always returns the same endpoint. | ||
// It can be used to use AWS emulators like Localstack. | ||
// | ||
// For example: | ||
// import ( | ||
// | ||
// "github.com/ThreeDotsLabs/watermill-amazonsns/sns" | ||
// amazonsns "github.com/aws/aws-sdk-go-v2/service/sns" | ||
// "github.com/aws/smithy-go/transport" | ||
// | ||
// ) | ||
// | ||
// pub, err := sns.NewPublisher(sns.PublisherConfig{ | ||
// AWSConfig: cfg, | ||
// Marshaler: sns.DefaultMarshalerUnmarshaler{}, | ||
// OptFns: []func(*amazonsns.Options){ | ||
// amazonsns.WithEndpointResolverV2(sns.OverrideEndpointResolver{ | ||
// Endpoint: transport.Endpoint{ | ||
// URI: url.URL{Scheme: "http", Host: "localstack:4566"}, | ||
// }, | ||
// }), | ||
// }, | ||
// }, logger) | ||
type OverrideEndpointResolver struct { | ||
Endpoint transport.Endpoint | ||
} | ||
|
||
func (o OverrideEndpointResolver) ResolveEndpoint(ctx context.Context, params sns.EndpointParameters) (transport.Endpoint, error) { | ||
return o.Endpoint, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.