File tree Expand file tree Collapse file tree
apps/consumers/src/services
packages/rabbitmq-client/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export class EnsResolverService {
1515 chain : mainnet ,
1616 transport : http ( undefined , {
1717 timeout : 5_000 , // 5 seconds timeout
18- retryCount : 2 , // Try 2 times
18+ retryCount : 10 , // Try 10 times
1919 retryDelay : 500 // Wait 500ms between retries
2020 } )
2121 } ) ;
Original file line number Diff line number Diff line change @@ -12,13 +12,22 @@ export class RabbitMQConnection {
1212 if ( urlObj . hostname === 'localhost' ) {
1313 urlObj . hostname = '127.0.0.1' ;
1414 }
15+ urlObj . searchParams . set ( 'heartbeat' , '30' ) ;
1516
1617 this . url = urlObj . toString ( ) ;
1718 }
1819
1920 async connect ( ) : Promise < void > {
2021 if ( ! this . connection ) {
2122 this . connection = new Connection ( this . url ) ;
23+ this . connection . on ( 'error' , ( err ) => {
24+ console . error ( '[RabbitMQ] Connection error:' , err . message ) ;
25+ } ) ;
26+
27+ this . connection . on ( 'connection' , ( ) => {
28+ console . log ( '[RabbitMQ] Connection (re)established' ) ;
29+ } ) ;
30+
2231 await this . connection . onConnect ( 5000 ) ;
2332 }
2433 }
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export class RabbitMQConsumer {
4646 ) ;
4747
4848 this . consumer . on ( 'error' , ( err ) => {
49- console . error ( ' [RabbitMQConsumer] Consumer error:' , err ) ;
49+ console . error ( ` [RabbitMQConsumer] Consumer error on queue ' ${ this . queueName } ':` , err . message ) ;
5050 } ) ;
5151
5252 this . isConsuming = true ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export class RabbitMQPublisher {
2727
2828 this . publisher = conn . createPublisher ( {
2929 confirm : true ,
30- maxAttempts : 3 ,
30+ maxAttempts : 10 ,
3131 exchanges : [ ]
3232 } ) ;
3333 }
You can’t perform that action at this time.
0 commit comments