내 프로젝트에 Spring Cloud Stream을 사용할 계획이다. Trigger source application starter가 내장되어 있습니다. 내가하고 싶은 일은 쿼츠 작업 스케줄러를 소스 앱으로 사용하는 것이다. 이것은 응용 프로그램에서 동적 작업 일정을 허용하는 것입니다. 이것을 달성하기위한 좋은 표본이 있습니까?Spring Cloud Stream + Quartz
찾았습니다. spring integration + cron + quartz in cluster?. 이 솔루션은 인바운드 채널 어댑터에 대한 참조를 얻는 방법에 대해 설명합니다. Annotation을 사용하여 인바운드 채널 어댑터를 정의합니다. 솔루션에서 언급 된 시작/중지를 할 수 있도록이 객체에 대한 참조를 어떻게 얻을 수 있습니까?
이것은 인바운드 채널 어댑터를 정의하는 방법입니다.
@Bean
@InboundChannelAdapter(autoStartup = "false", value = SourceChannel.CHANNEL_NAME, poller = @Poller(trigger = "fireOnceTrigger"))
public MessageSource<String> timerMessageSource() {
return new MessageSource<String>() {
public Message<String> receive() {
System.out.println("******************");
System.out.println("At the Source");
System.out.println("******************");
String value = "{\"value\":\"hi\"}";
System.out.println("Sending value: " + value);
return MessageBuilder.withPayload(value).setHeader(MessageHeaders.CONTENT_TYPE, "application/json").build();
}
};
}
감사합니다. 이 작동합니다. –