@@ -103,6 +103,7 @@ export class SqsController extends EventController implements EventControllerInt
103103 }
104104
105105 if ( this . sqs ) {
106+ const serverConfig = configService . get < HttpServer > ( 'SERVER' ) ;
106107 const sqsConfig = configService . get < Sqs > ( 'SQS' ) ;
107108
108109 const we = event . replace ( / [ . - ] / gm, '_' ) . toUpperCase ( ) ;
@@ -118,7 +119,6 @@ export class SqsController extends EventController implements EventControllerInt
118119 }
119120
120121 if ( Array . isArray ( sqsEvents ) && sqsEvents . includes ( we ) ) {
121- const serverName = sqsConfig . GLOBAL_ENABLED ? configService . get < HttpServer > ( 'SERVER' ) . NAME : 'evolution' ;
122122 const prefixName = sqsConfig . GLOBAL_ENABLED ? sqsConfig . GLOBAL_PREFIX_NAME : instanceName ;
123123 const eventFormatted =
124124 sqsConfig . GLOBAL_ENABLED && sqsConfig . GLOBAL_FORCE_SINGLE_QUEUE
@@ -132,7 +132,7 @@ export class SqsController extends EventController implements EventControllerInt
132132 instance : instanceName ,
133133 dataType : 'json' ,
134134 data,
135- server : serverName ,
135+ server : serverConfig . NAME ,
136136 server_url : serverUrl ,
137137 date_time : dateTime ,
138138 sender,
@@ -163,10 +163,11 @@ export class SqsController extends EventController implements EventControllerInt
163163 message . dataType = 's3' ;
164164 }
165165
166- const isGlobalEnabled = configService . get < Sqs > ( 'SQS' ) . GLOBAL_ENABLED ;
166+ const messageGroupId = sqsConfig . GLOBAL_ENABLED ? `${ serverConfig . NAME } -${ instanceName } ` : 'evolution' ;
167+ const isGlobalEnabled = sqsConfig . GLOBAL_ENABLED ;
167168 const params = {
168169 MessageBody : JSON . stringify ( message ) ,
169- MessageGroupId : serverName ,
170+ MessageGroupId : messageGroupId ,
170171 QueueUrl : sqsUrl ,
171172 ...( ! isGlobalEnabled && {
172173 MessageDeduplicationId : `${ instanceName } _${ eventFormatted } _${ Date . now ( ) } ` ,
@@ -208,9 +209,7 @@ export class SqsController extends EventController implements EventControllerInt
208209
209210 for ( const event of events ) {
210211 const normalizedEvent =
211- sqsConfig . GLOBAL_ENABLED && sqsConfig . GLOBAL_FORCE_SINGLE_QUEUE
212- ? 'singlequeue'
213- : event . toLowerCase ( ) ;
212+ sqsConfig . GLOBAL_ENABLED && sqsConfig . GLOBAL_FORCE_SINGLE_QUEUE ? 'singlequeue' : event . toLowerCase ( ) ;
214213 if ( eventsFinded . includes ( normalizedEvent ) ) {
215214 this . logger . info ( `A queue para o evento "${ normalizedEvent } " já existe. Ignorando criação.` ) ;
216215 continue ;
0 commit comments