title: What's the best way to run method of Component (Service) just after bootstrap running?
body: <p>I'm using NestJS instance as microservice (without HTTP).</p>
  <p>I need to run Component's method that is infinity loop with some business logic just after bootstrap initialization.</p>
  <p>What is the best way to do it?</p>
  <p><strong>src/main.ts</strong></p>
  <pre><code>import {NestFactory} from '@nestjs/core';
  import {ApplicationModule} from './app.module';
  import {Transport} from '@nestjs/microservices';
  
  async function bootstrap() {
      const app = await NestFactory.create(ApplicationModule);
      app.connectMicroservice({
          transport: Transport.REDIS,
          url: 'redis://:redis_pass@localhost:6379',
      });
      await app.startAllMicroservicesAsync();
  
      // Probably here I must run startLoop method from app.service.ts
      
  }
  bootstrap();
  </code></pre>
  <p><strong>src/app.service.ts</strong></p>
  <pre><code>import { Component } from '@nestjs/common';
  
  @Component()
  export class AppService {
  
      startLoop() {
          let timerId = setTimeout(function loop() {
              console.log('Loop process');
              // Some business logic here
              timerId = setTimeout(loop, 1000);
          }, 1000);
      }
  
  }
  </code></pre>