File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/api/integrations/event/sqs Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -167,10 +167,14 @@ export class SqsController extends EventController implements EventControllerInt
167167 message . dataType = 's3' ;
168168 }
169169
170+ const isGlobalEnabled = configService . get < Sqs > ( 'SQS' ) . GLOBAL_ENABLED ;
170171 const params = {
171172 MessageBody : JSON . stringify ( message ) ,
172173 MessageGroupId : 'evolution' ,
173174 QueueUrl : sqsUrl ,
175+ ...( ! isGlobalEnabled && {
176+ MessageDeduplicationId : `${ instanceName } _${ eventFormatted } _${ Date . now ( ) } ` ,
177+ } ) ,
174178 } ;
175179
176180 this . sqs . sendMessage ( params , ( err ) => {
@@ -217,13 +221,15 @@ export class SqsController extends EventController implements EventControllerInt
217221
218222 const queueName = `${ prefixName } _${ normalizedEvent } .fifo` ;
219223 try {
224+ const isGlobalEnabled = configService . get < Sqs > ( 'SQS' ) . GLOBAL_ENABLED ;
220225 const createCommand = new CreateQueueCommand ( {
221226 QueueName : queueName ,
222227 Attributes : {
223228 FifoQueue : 'true' ,
224- ContentBasedDeduplication : 'true'
229+ ... ( isGlobalEnabled && { ContentBasedDeduplication : 'true' } ) ,
225230 } ,
226231 } ) ;
232+
227233 const data = await this . sqs . send ( createCommand ) ;
228234 this . logger . info ( `Queue ${ queueName } criada: ${ data . QueueUrl } ` ) ;
229235 } catch ( err : any ) {
You can’t perform that action at this time.
0 commit comments