Search code examples
javaspringrabbitmqamqpspring-amqp

Spring RabbitMQ listener returns a string with comma seperated ASCII decimals


I have a basic RabbitMQ listener in java using the spring framework rabbitmq listener annotation.

@RabbitListener(containerFactory="rabbitListenerContainerFactory", queues="myQueue")
public void process(@Header(value="type", required=true) String messageType, @Payload() String data){
   System.out.println(data);
}

If the message contains the payload

"test"

the returned data comes back as

"116,101,115,116"  

It's still a string, but a string of ascii characters.

I'm posting the messages from the Rabbit web interface and if I read them from the web interface the payload is still a normal string.

Any ideas why this is happening?


Solution

  • Problem solved. It wasn't anything to do with java. The content_type wasn't being set within the message properties, it was in the header...