mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-13 11:59:35 -06:00
feat/force MessageGroupId
This commit is contained in:
parent
23cd6d2fd8
commit
17120e91a4
@ -118,13 +118,13 @@ export class SqsController extends EventController implements EventControllerInt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(sqsEvents) && sqsEvents.includes(we)) {
|
if (Array.isArray(sqsEvents) && sqsEvents.includes(we)) {
|
||||||
|
const serverName = sqsConfig.GLOBAL_ENABLED ? configService.get<HttpServer>('SERVER').NAME : 'evolution';
|
||||||
const prefixName = sqsConfig.GLOBAL_ENABLED ? sqsConfig.GLOBAL_PREFIX_NAME : instanceName;
|
const prefixName = sqsConfig.GLOBAL_ENABLED ? sqsConfig.GLOBAL_PREFIX_NAME : instanceName;
|
||||||
const eventFormatted =
|
const eventFormatted =
|
||||||
sqsConfig.GLOBAL_ENABLED && sqsConfig.GLOBAL_FORCE_SINGLE_QUEUE
|
sqsConfig.GLOBAL_ENABLED && sqsConfig.GLOBAL_FORCE_SINGLE_QUEUE
|
||||||
? 'singlequeue'
|
? 'singlequeue'
|
||||||
: `${event.replace('.', '_').toLowerCase()}`;
|
: `${event.replace('.', '_').toLowerCase()}`;
|
||||||
const queueName = `${prefixName}_${eventFormatted}.fifo`;
|
const queueName = `${prefixName}_${eventFormatted}.fifo`;
|
||||||
|
|
||||||
const sqsUrl = `https://sqs.${sqsConfig.REGION}.amazonaws.com/${sqsConfig.ACCOUNT_ID}/${queueName}`;
|
const sqsUrl = `https://sqs.${sqsConfig.REGION}.amazonaws.com/${sqsConfig.ACCOUNT_ID}/${queueName}`;
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
@ -132,7 +132,7 @@ export class SqsController extends EventController implements EventControllerInt
|
|||||||
instance: instanceName,
|
instance: instanceName,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data,
|
data,
|
||||||
server: configService.get<HttpServer>('SERVER').NAME,
|
server: serverName,
|
||||||
server_url: serverUrl,
|
server_url: serverUrl,
|
||||||
date_time: dateTime,
|
date_time: dateTime,
|
||||||
sender,
|
sender,
|
||||||
@ -166,7 +166,7 @@ export class SqsController extends EventController implements EventControllerInt
|
|||||||
const isGlobalEnabled = configService.get<Sqs>('SQS').GLOBAL_ENABLED;
|
const isGlobalEnabled = configService.get<Sqs>('SQS').GLOBAL_ENABLED;
|
||||||
const params = {
|
const params = {
|
||||||
MessageBody: JSON.stringify(message),
|
MessageBody: JSON.stringify(message),
|
||||||
MessageGroupId: 'evolution',
|
MessageGroupId: serverName,
|
||||||
QueueUrl: sqsUrl,
|
QueueUrl: sqsUrl,
|
||||||
...(!isGlobalEnabled && {
|
...(!isGlobalEnabled && {
|
||||||
MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`,
|
MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user