title: fail to consume kafka events with nestjs
body: <p>I wanted to consume Kafka messages and thus I've invoked the <code>emit()</code> message first which successfully stored a message in Kafka.</p>
  <p>I can see that by running the batch file: <code>bin/windows/kafka-console-consumer.bat --topic signals --from-beginning --bootstrap-server localhost:9092</code></p>
  <p>and the new message is logged.
  {&quot;botId&quot;:&quot;TKS&quot;,&quot;emailToken&quot;:&quot;38fhsf29h&quot;,&quot;pair&quot;:&quot;xy&quot;,&quot;size&quot;:100}</p>
  <p>This is my nodejs/nestjs service file. What am I missing in my script - since the same script writes successfully to Kafka? I've tried <code>@MessagePattern</code> and <code>@EventPattern</code> to consume the message. Any ideas?</p>
  <pre><code>import { Injectable, OnModuleInit } from '@nestjs/common';
  import { TVSignal } from './tvsignal';
  import { Client, ClientKafka, EventPattern, MessagePattern, Payload, Transport } from &quot;@nestjs/microservices&quot;;
  import { Logger } from '@nestjs/common';
  import { EventEmitter2 } from '@nestjs/event-emitter';
  
  @Injectable()
  export class AppService implements OnModuleInit {
  
    constructor(private eventEmitter: EventEmitter2) {}
  
    @Client({
      transport: Transport.KAFKA,
      options: {
        client: {
          clientId: 'trading-signal-receiver',
          brokers: ['localhost:9092'],
        },
        consumer: {
          groupId: 'signals',
          allowAutoTopicCreation: true
        },
        producer: {
        }
      }
    })
    kafkaClient: ClientKafka;
  
  
    async onModuleInit() {
      this.kafkaClient.subscribeToResponseOf('signals');
      await this.kafkaClient.connect();
      Logger.log(&quot;consumer assignments: &quot; + JSON.stringify(this.kafkaClient.getConsumerAssignments()))
  
    }
    
    // DOES NOT WORK
    @EventPattern('signals')
    async handleEntityCreated(payload: any) {
      Logger.log(&quot;RECEIVED NEW: &quot;+ JSON.stringify(payload));
    }
  
    getTradingSignals(): string {
      return &quot;&quot;
    }
  
    // DOES NOT WORK
    @MessagePattern('signals') // Our topic name
    getMessage(@Payload() message) {
      Logger.log(&quot;RECEIVED KAFKA MSG&quot; + message.value);
      return 'Hello World';
    }
  
  
      // WORKS
      storeSignal(signal: TVSignal){
      Logger.log(&quot;STORED: &quot; + JSON.stringify(signal))  
      Logger.log(&quot;consumer assignments: &quot; + JSON.stringify(this.kafkaClient.getConsumerAssignments()))
      // send message to OnEvent
      this.eventEmitter.emit('signal.saved', signal);
      // store obj in kafka
      return this.kafkaClient.emit('signals', signal); // args - topic, message
      
    }
  
    
  
  }
  </code></pre>