【问题标题】:spring cloud stream and gcp pub sub, binder problemspring cloud stream和gcp pub sub,binder问题
【发布时间】:2019-07-07 21:17:03
【问题描述】:

我正在尝试使用 GCP 的 Pub Sum 作为活页夹在本地运行 SCS 应用程序。 ķ 米 嗯嗯嗯。嗯 org.sm.Mpringframework.cloudkki spring-cloud-gcp-starter-pubsub 米 这里是configl

@Configu@Configukration
@EnableBindingkklk(Source.class)
public class TimerSourcek {

  @Bean
  @InboundChannelAdapter(channel = "channel", poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1"))
  public MessageSource<String> timerMessageSource() {
    return () -> new GenericMessage<>(new SimpleDateFormat("HH:mm:ss").format(new Date()));
  }
}

这是启动主应用时的错误消息:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-02-13 15:42:48.627 ERROR 22276 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalArgumentException: A default binder has been requested, but there is no binder available

我想在本地或针对我的 GCP 项目运行此代码。怎么可能?

【问题讨论】:

    标签: spring-cloud spring-cloud-stream


    【解决方案1】:

    spring-cloud-gcp-starter-pubsub 不会为您带来活页夹依赖项。 您还需要使用spring-cloud-gcp-pubsub-stream-binder

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-gcp-pubsub-stream-binder</artifactId>
        </dependency>
    

    查看项目中的示例了解更多信息:https://github.com/spring-cloud/spring-cloud-gcp/tree/master/spring-cloud-gcp-samples

    【讨论】:

    • 错误消失了,但我期待会根据spring.cloudstream.bindings.output.destination=inbox创建一个名为“inbox”的新主题,但实际上并没有
    • 听起来像是一个包含更多细节的新问题。它不像这里的聊天那样工作......
    猜你喜欢
    • 2019-07-08
    • 2022-01-13
    • 2019-07-03
    • 1970-01-01
    • 2023-01-28
    • 2019-04-19
    • 2019-11-03
    • 1970-01-01
    • 2020-08-21
    相关资源
    最近更新 更多