Converting Message from RabbitMQ into string/json

前端 未结 2 1635
傲寒
傲寒 2021-01-12 02:44

I am currently struggling hard with a fair simple problem. I want to receive a message from RabbitMQ and have that transformed into a string (or later a json object). But al

2条回答
  •  青春惊慌失措
    2021-01-12 03:05

    message.getBody() returns a byte[]

    Try:

    byte[] body = message.getBody();
    System.out.println(new String(body));
    

提交回复
热议问题