title: does NestJS rabbitmq microservice requires the application to listen to all incoming message patterns?
body: <p>I have two rabbitmq nestjs microservices. Both services listening to the same queue</p>
  <p>Message flow:</p>
  <pre><code>MyQueue(pattern: events) -&gt; ServiceA -&gt; MyQueue(pattern: logs) -&gt; ServiceB
  </code></pre>
  <p>The message flow is working fine but i am getting following error log when ServiceA sends a message to ServiceB</p>
  <pre><code>[Server] There is no matching event handler defined in the remote service.
  </code></pre>
  <br/>
  <p>Now the question is, in NestJS is it assumed that a service should listen to all incoming message patterns? If no then how to handle this error?</p>
  <br/>
  <p><strong>Code:</strong></p>
  <pre><code>/* 
  * ServiceA
  */ 
  
  import {EventPattern} from '@nestjs/microservices';
  
  export class EventsController {
    private client: ClientProxy;
  
    constructor() {
      this.client = ClientProxyFactory.create(getRabbitMQClientOptions());
    }
  
    @EventPattern('events')
    handleEvents(data) {
      this.client.emit('logs', data);
  
      // process
    }
  }
  
  /* 
  * ServiceB
  */ 
  
  import {EventPattern} from '@nestjs/microservices';
  
  export class LogsController {
  
    @EventPattern('logs')
    handleLogs(data) {
      // handle logs
    }
  }
  </code></pre>
  <br/>
  <p><strong>Possible solution:</strong></p>
  <p>Use different queues. But then i have to change a lot of code</p>
  <br/>
  <p>Note:
  NestJS code that logs the error if it doesn't find the matching handler. <a href="https://github.com/nestjs/nest/blob/master/packages/microservices/server/server.ts#L98." rel="nofollow noreferrer">Github code link</a></p>