File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
api/integrations/event/rabbitmq Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ DATABASE_DELETE_MESSAGE=true
5050RABBITMQ_ENABLED = false
5151RABBITMQ_URI = amqp://localhost
5252RABBITMQ_EXCHANGE_NAME = evolution
53+ RABBITMQ_FRAME_MAX = 8192
5354# Global events - By enabling this variable, events from all instances are sent in the same event queue.
5455RABBITMQ_GLOBAL_ENABLED = false
5556# Prefix key to queue name
Original file line number Diff line number Diff line change @@ -21,9 +21,21 @@ export class RabbitmqController extends EventController implements EventControll
2121
2222 await new Promise < void > ( ( resolve , reject ) => {
2323 const uri = configService . get < Rabbitmq > ( 'RABBITMQ' ) . URI ;
24+ const frameMax = configService . get < Rabbitmq > ( 'RABBITMQ' ) . FRAME_MAX ;
2425 const rabbitmqExchangeName = configService . get < Rabbitmq > ( 'RABBITMQ' ) . EXCHANGE_NAME ;
2526
26- amqp . connect ( uri , ( error , connection ) => {
27+ const url = new URL ( uri ) ;
28+ const connectionOptions = {
29+ protocol : url . protocol . slice ( 0 , - 1 ) ,
30+ hostname : url . hostname ,
31+ port : url . port || 5672 ,
32+ username : url . username || 'guest' ,
33+ password : url . password || 'guest' ,
34+ vhost : url . pathname . slice ( 1 ) || '/' ,
35+ frameMax : frameMax
36+ } ;
37+
38+ amqp . connect ( connectionOptions , ( error , connection ) => {
2739 if ( error ) {
2840 reject ( error ) ;
2941
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ export type EventsRabbitmq = {
9595export type Rabbitmq = {
9696 ENABLED : boolean ;
9797 URI : string ;
98+ FRAME_MAX : number ;
9899 EXCHANGE_NAME : string ;
99100 GLOBAL_ENABLED : boolean ;
100101 EVENTS : EventsRabbitmq ;
@@ -391,6 +392,7 @@ export class ConfigService {
391392 PREFIX_KEY : process . env ?. RABBITMQ_PREFIX_KEY ,
392393 EXCHANGE_NAME : process . env ?. RABBITMQ_EXCHANGE_NAME || 'evolution_exchange' ,
393394 URI : process . env . RABBITMQ_URI || '' ,
395+ FRAME_MAX : Number . parseInt ( process . env . RABBITMQ_FRAME_MAX ) || 8192 ,
394396 EVENTS : {
395397 APPLICATION_STARTUP : process . env ?. RABBITMQ_EVENTS_APPLICATION_STARTUP === 'true' ,
396398 INSTANCE_CREATE : process . env ?. RABBITMQ_EVENTS_INSTANCE_CREATE === 'true' ,
You can’t perform that action at this time.
0 commit comments