@SpringBootApplication
-@EnableModule
-@ComponentScan(basePackageClasses=ModuleDefinition.class)
+@ComponentScan(basePackageClasses=TimerSource.class)
public class ModuleApplication {
public static void main(String[] args) throws InterruptedException {
@@ -436,18 +435,14 @@ public class ModuleApplication {
}
@Configuration
-public class ModuleDefinition {
+@EnableModule(Source.class)
+public class TimerSource {
@Value("${format}")
private String format;
@Bean
- public MessageChannel output() {
- return new DirectChannel();
- }
-
- @Bean
- @InboundChannelAdapter(value = "output", autoStartup = "false", poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
+ @InboundChannelAdapter(value = Source.OUTPUT, autoStartup = "false", poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
public MessageSource<String> timerMessageSource() {
return () -> new GenericMessage<>(new SimpleDateFormat(format).format(new Date()));
}
@@ -468,13 +463,58 @@ spring:
outputChannelName: ${spring.application.name:ticker}