春のクラウドストリームプロデューサースケジューリングが動作しません

BRAX:

私が使用してメッセージを生成するためのスプリングスケジューリングを使用したい@Scheduledが、私はそれを動作させることができないのです。ここに私のプロデューサーは次のとおりです。

@SpringBootApplication
@EnableScheduling
public class ProducerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ProducerApplication.class, args);
    }

    private int counter;

    @Bean
    @Scheduled(fixedDelay = 100)
    public Supplier<String> producer() {
        return () -> "Hello " + counter++;
    }

}

application.yaml:

spring:
  cloud:
    stream:
      bindings:
        producer:
          destination: input-destination
          group: input-group

      function:
        bindings:
          producer-out-0: producer

ここでは消費者は次のとおりです。

@SpringBootApplication
public class ConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

    @Bean
    public Consumer<String> consumer() {
        return System.out::println;
    }

}

application.yaml:

spring:
  cloud:
    stream:
      bindings:
        consumer:
          destination: input-destination
          group: input-group

      function:
        bindings:
          consumer-in-0: consumer

私はこれが上で実行したい100MSが、それはデフォルトの設定で実行されてやっています1000どのように私はこの作業を得ることができますか?

サム:

あなたは使用することができspring.cloud.stream.poller.fixed-delay=100ポーリング時間を設定するには、アプリケーションのプロパティを。値はミリ秒単位です。の例application.yml

spring:
  cloud:
    stream:
      poller:
        fixed-delay: 100

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=345230&siteId=1