【问题标题】:How to send and wait for return message with spring cloud stream RabbitMQ?如何使用 Spring Cloud Stream RabbitMQ 发送和等待返回消息?
【发布时间】:2017-05-22 20:28:26
【问题描述】:

我正在尝试使用 spring 云流发送消息,但我没有找到如何发送消息并以与使用 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?
}

【问题讨论】:

    标签: java rabbitmq spring-cloud-stream


    【解决方案1】:

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

    【讨论】:

    • 好的,感谢 Gary 的回复,但是此时我可以将 rabbitTemplate 与 spring 流一起使用而不会出现冲突问题吗?在这部分我需要消费者的回应吗:(
    • 是的,您可以在流应用中使用兔子模板。
    猜你喜欢
    • 1970-01-01
    • 2021-06-12
    • 2021-05-07
    • 1970-01-01
    • 1970-01-01
    • 2021-04-27
    • 2021-03-25
    • 2018-06-20
    • 2020-07-26
    相关资源
    最近更新 更多