编程知识 cdmana.com

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,即可。

 

版权声明
本文为[IT1995]所创,转载请带上原文链接,感谢
https://it1995.blog.csdn.net/article/details/111628302

Scroll to Top