当前位置: 首页 > 知识库问答 >
问题:

时间戳提取器昵称设置在Spring云流应用程序不会覆盖默认值

湛鸿雪
2023-03-14

对于使用Kafka Streams绑定器的Spring Cloud Stream应用程序,我有以下属性:

spring.cloud.stream.bindings:
  windowStream-in-0:
    destination: input
  windowStream-out-0:
    destination: window1
  hint1Stream-in-0:
    destination: window1
  hint1Stream-out-0:
    destination: hints
  realityStream-in-0:
    destination: input
  realityStream-in-1:
    destination: window1
    consumer:
      timestampExtractorBeanName: anotherTimestampExtractor
  realityStream-out-0:
    destination: hints
  countStream-in-0:
    destination: hints

spring.cloud.stream.kafka.streams:
  default:
    consumer:
      timestampExtractorBeanName: timestampExtractor
  binder:
    functions:
      windowStream:
        applicationId: mock-stream-window1
      hint1Stream:
        applicationId: mock-stream-hints
      realityStream:
        applicationId: mock-stream-reality
      countStream:
        applicationId: mock-stream-count
    stateStoreRetry:
      maxAttempts: 3
      backOffInterval: 1000
    configuration:
      schema.registry.url: mock://mock-stream-registry
      default.key.serde: org.apache.kafka.common.serialization.Serdes$StringSerde
      default.value.serde: io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
      commit.interval.ms: 100

我试图做的是对所有流使用“时间戳提取器”,除了一个称为“现实流”的流。

为此,我设置了<code>spring.cloud.stream.kafka.streams.default.consumer。timestampExtractor BeanName设置为timestampExtractor,然后尝试通过设置spring.cloud.stream.bindings.realityStream-in-1.consumer.timestampExtactor Beanname为“realityStriam”覆盖它

不幸的是,我的重写似乎不起作用,因为只有“时间戳Exrctor”被调用,正如我在调试器(和测试结果)中看到的那样。

我是应用了错误的配置,还是有错误的期望?

这是我的单个Spring Cloud Streams应用程序中的流的图片:

(橙色圆圈是我想应用非默认时间戳提取器的地方)


共有1个答案

丰博
2023-03-14
匿名用户

超驰装置在错误的地方;它需要在< code >下....Kafka . streams . bindings . reality流合一....属性。

这是Kafka特有的属性;在泛型绑定属性中(所有绑定器都通用)中具有它。

 类似资料:
  • 我的类路径中有多个应用服务器,即通过spring-boot-starter-webflux的Netty和通过另一个依赖链的Tomcat。我如何确定在Spring Boot使用哪个应用服务器? 目前,Tomcat正在取代Netty启动。 重要提示:我不能排除任何一个,Tomcat是CXF用的,Netty是WebClient用的。

  • 我无法覆盖REST API中默认的Spring Boot错误响应。我有以下代码 然后在我的REST api中抛出这个BusinessValidationException。这个处理程序被调用(我可以在调试器中看到它),但是我仍然得到缺省的Spring BootREST错误消息。是否有一种方法可以重写并仅将default用作后退?带有Groovy的Spring Boot版本1.3.2。最诚挚的问候

  • 本文向大家介绍vagrant 在Vagrantfile中设置默认提供程序,包括了vagrant 在Vagrantfile中设置默认提供程序的使用技巧和注意事项,需要的朋友参考一下 示例            

  • 我想在elasticsearch中组织我的数据并使用kibana可视化它。我使用elasticsearch 1.4.4和Kibana3。 我所有数据的elasticsearch是,我有两种文档类型和。我在开始时运行下面的脚本,并期望格式的时间戳字段,值为文档的插入时间。我的理解是每个文档都有一个时间戳字段。我在kibana中看不到这个字段。Kibana说但是我似乎无法将其设置为仪表板的时间戳。我在

  • 我想覆盖服务器faces web应用程序中的默认Hibernate验证程序消息,因此我阅读了这部分文档:https://docs.jboss.org/hibernate/validator/5.0/reference/en-US/html/chapter-message-interpolation.html#section-消息插值 我在文件夹中创建了两个文件:和。文件内容为: 我使用的是德语版本

  • 这个服务我已经测试了它,使用不同版本的Kafka(更高或等于0.10),它工作良好。 以下是我的配置: Spring:cloud:stream:kafka:streams:binder:brokers:${KAFKA_BROKERS}applicationid:email-MESSAGES-stream configuration:default.key.serde:org.apache.kafk