Spring Batch Integration job-launching-gateway

戏子无情 提交于 2019-12-24 07:06:51

问题


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:


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.



来源:https://stackoverflow.com/questions/27770377/spring-batch-integration-job-launching-gateway

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!