Java笔记-Spring-rabbitmq中设置receiveMessage参数为Message

如下代码:

public void receiveMessage(Message message){
	......
    ......
}

其中对应的Message为此包:

import org.springframework.amqp.core.Message;

在listner中这样设置就可以了:

    MessageListenerAdapter listenerAdapter(Receiver receiver){

        MessageListenerAdapter receiveMessage = new MessageListenerAdapter(receiver, "receiveMessage");
        receiveMessage.setMessageConverter(null);
        return receiveMessage;
    }

关键代码是将MessageConverter设置为null,即可。

 

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页