[英]Spring Cloud Stream Function support does not work
I trying to use Spring Cloud Stream with functions as that described in this topic .我尝试将 Spring Cloud Stream 与本主题中描述的功能一起使用。 But it does not work.但它不起作用。
My function:我的功能:
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
@Bean
public Consumer<String> consumer() {
return s -> System.out.println(s);
}
}
And I push message.我推送消息。 to the consumer-in-0
channel via producer that made with @Output
annotation:通过使用@Output
注释制作的生产者到consumer-in-0
通道:
pulic interface Source {
@Output("source")
MessageChannel producer();
}
source.producer().send(MessageBuilder.withPayload("Hello").build());
My yaml channels configuration:我的 yaml 频道配置:
spring:
cloud:
function:
definition: consumer
stream:
bindings:
source:
destination: consumer-in-0
If I use consumer via @Input
configuration - everything ok.如果我通过@Input
配置使用消费者 - 一切正常。 Also in rabbitmq manager I see that producer is working and sending messages, but consumer does not consuming them.同样在 rabbitmq 管理器中,我看到生产者正在工作并发送消息,但消费者没有消费它们。 Help me please somebody.帮我取悦某人。
PS I also use Spring WebFlux PS 我也使用 Spring WebFlux
You cannot mix EnableBinding
and functional model in the same application.您不能在同一个应用程序中混合使用EnableBinding
和功能模型。 If you are putting both producer and consumer in the same application, you might want to convert your producer using a Supplier
.如果您将生产者和消费者放在同一个应用程序中,您可能希望使用Supplier
转换您的生产者。 For eg例如
@Bean
public Supplier<String> supplier() {
return () -> MessageBuilder.withPayload("Hello").build();
}
Then,然后,
spring:
cloud:
function:
definition: supplier;consumer
stream:
bindings:
supplier-out-0:
destination: consumer-in-0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.