Java 如何使用spring cloud stream RabbitMQ发送和等待返回消息?

Java 如何使用spring cloud stream RabbitMQ发送和等待返回消息?,java,rabbitmq,spring-cloud-stream,Java,Rabbitmq,Spring Cloud Stream,我试图使用SpringCloud流来发送消息,但我找不到如何以与使用rabbitTemplate相同的方法发送消息并获得返回 RabbitTemplate template = new RabbitTemplate(cf); //configs template here... Object test = template.convertSendAndReceive("Hello world"); //On Cloud Stream private MessageChannel output;

我试图使用SpringCloud流来发送消息,但我找不到如何以与使用rabbitTemplate相同的方法发送消息并获得返回

RabbitTemplate template = new RabbitTemplate(cf);
//configs template here...
Object test = template.convertSendAndReceive("Hello world");

//On Cloud Stream
private MessageChannel output;

public <T extends DomainEvent> void publish(T domainEvent){
    output.send(MessageBuilder.withPayload(domainEvent).build());
    //How to wait and receive the answer?
}
RabbitTemplate=新的RabbitTemplate(cf);
//在此配置模板。。。
对象测试=template.convertSendAndReceive(“Hello world”);
//云端流
专用信道输出;
公共无效发布(T domainEvent){
send(MessageBuilder.withPayload(domainEvent.build());
//如何等待并获得答案?
}

Spring Cloud Stream不是为请求/回复消息而设计的。

好的,谢谢您的回复,Gary,但是我现在可以在Spring Stream中使用rabbitTemplate而不存在冲突问题吗?在这一部分中,我需要消费者的回应:(是的,你可以在流应用程序中使用兔子模板。