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
私はこれが上で実行したい100
MSが、それはデフォルトの設定で実行されてやっています1000
。どのように私はこの作業を得ることができますか?
サム:
あなたは使用することができspring.cloud.stream.poller.fixed-delay=100
ポーリング時間を設定するには、アプリケーションのプロパティを。値はミリ秒単位です。の例application.yml
:
spring:
cloud:
stream:
poller:
fixed-delay: 100