Why RabbitMQ message should be in different format for NestJs consumers?

I want a non-NestJS client(Publisher) to send messages to a queue and to have a consumer in the NestJS service using the EventPattern decorator. it looks after some research that the publisher should send the messages in this format:

{ 
  pattern:"pattern_name", 
  data: {...}
}

Otherwise, the NestJS service reports an error message:
“There is no matching event handler defined in the remote service. Event pattern: undefined.”

Is there a way that NestJS message consumers handle messages without the wrapper of adding the pattern and data fields to the JSON message?

Read more here: Source link