File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 6
6
"sync"
7
7
"time"
8
8
9
+ "github.com/tidwall/gjson"
10
+
9
11
"github.com/aws/aws-sdk-go/aws"
10
12
"github.com/aws/aws-sdk-go/aws/credentials"
11
13
"github.com/aws/aws-sdk-go/aws/session"
@@ -108,11 +110,17 @@ func (conn *SQSConn) Send(msg string) error {
108
110
}
109
111
110
112
queueURL := conn .generateSQSURL ()
111
- // Send message
113
+ // Create message
112
114
sendParams := & sqs.SendMessageInput {
113
115
MessageBody : aws .String (msg ),
114
116
QueueUrl : aws .String (queueURL ),
115
117
}
118
+ if isFifoQueue (queueURL ) {
119
+ key := gjson .Get (msg , "key" )
120
+ id := gjson .Get (msg , "id" )
121
+ keyValue := fmt .Sprintf ("%s#%s" , key .String (), id .String ())
122
+ sendParams .MessageGroupId = aws .String (keyValue )
123
+ }
116
124
_ , err := conn .svc .SendMessage (sendParams )
117
125
if err != nil {
118
126
fmt .Println (err )
@@ -145,3 +153,7 @@ func sqsRegionFromPlainURL(s string) string {
145
153
}
146
154
return ""
147
155
}
156
+
157
+ func isFifoQueue (s string ) bool {
158
+ return strings .HasSuffix (s , ".fifo" )
159
+ }
You can’t perform that action at this time.
0 commit comments