1
votes

I am working on simple project that will lunch a job when a new file is created in specific folder but i don't want to use xml only java annotation , so my question is how can i implement the below in code

<batch-int:job-launching-gateway request-channel="outboundJobRequestChannel"
reply-channel="jobLaunchReplyChannel"/>

<int:logging-channel-adapter channel="jobLaunchReplyChannel"/>

BR Shahbour

1

1 Answers

2
votes

Use the Spring Integration Java DSL; in your case, you would use

...
.handle(jobLauncher())
.handle(logger())
...

Where jobLauncher() is a JobLaunchingGateway @Bean and logger() is a LoggingHandler @Bean.

Or use...

@ServiceActivator(...)
@Bean
public JobLaunchingGateway jlg() {...}

etc., in that case, you need to wire in the output channel to the gateway, which is not needed in the DSL.