Skip to content

Commit a171664

Browse files
committed
feat: add global SQS configuration
1 parent 1f3858b commit a171664

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/api/integrations/event/sqs/sqs.controller.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)