File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package sns
33import (
44 "context"
55 "encoding/json"
6+ "strings"
67
78 "github.com/aws/aws-sdk-go/aws"
89 "github.com/aws/aws-sdk-go/aws/request"
@@ -37,6 +38,8 @@ type Publisher struct {
3738func (p * Publisher ) Publish (ctx context.Context , msg interface {}) error {
3839 b , err := json .Marshal (msg )
3940
41+ defaultMessageGroupID := "default"
42+
4043 if err != nil {
4144 return err
4245 }
@@ -45,6 +48,10 @@ func (p *Publisher) Publish(ctx context.Context, msg interface{}) error {
4548 Message : aws .String (string (b )),
4649 TopicArn : & p .cfg .TopicArn ,
4750 }
51+ // if the topic is a fifo topic, we need to set the message group id
52+ if strings .Contains (strings .ToLower (* input .TopicArn ), "fifo" ) {
53+ input .MessageGroupId = & defaultMessageGroupID
54+ }
4855
4956 _ , err = p .sns .PublishWithContext (ctx , input )
5057
You can’t perform that action at this time.
0 commit comments