i put hook somewhere in following code/config able spot jobinstancealreadycompleteexception , email production support team occurred.
i have tried jobexecutionlistener#beforejob() method in spring batch, jobinstancealreadycompleteexception occurring before job execution.
i using spring batch integration configuration documentation:
<int:channel id="inboundfilechannel"/> <int:channel id="outboundjobrequestchannel"/> <int:channel id="joblaunchreplychannel"/> <int-file:inbound-channel-adapter id="filepoller" channel="inboundfilechannel" directory="file:/tmp/myfiles/" filename-pattern="*.csv"> <int:poller fixed-rate="1000"/> </int-file:inbound-channel-adapter> <int:transformer input-channel="inboundfilechannel" output-channel="outboundjobrequestchannel"> <bean class="io.spring.sbi.filemessagetojobrequest"> <property name="job" ref="personjob"/> <property name="fileparametername" value="input.file.name"/> </bean> </int:transformer> i want handle jobinstancealreadycompleteexception in case same csv file name appears job parameter. extend org.springframework.integration.handler.logginghandler?
i notice class reporting error:
error org.springframework.integration.handler.logginghandler - org.springframework.messaging.messagehandlingexception: org.springframework.batch.core.repository.jobinstancealreadycompleteexception: job instance exists , complete parameters={input.file.name=c:\users\csv\file2015.csv}. if want run job again, change parameters.
the error org.springframework.integration.handler.logginghandler done default errorchannel reached <poller> on <int-file:inbound-channel-adapter>.
so, handle manually need specify own error-channel there go ahead email sending:
<int-file:inbound-channel-adapter> <int:poller fixed-rate="1000" error-channel="senderrortoemailchannel"/> </int-file:inbound-channel-adapter> <int-mail:outbound-channel-adapter id="senderrortoemailchannel"/> of course, have errormessage transformation before sending ti on e-mail, details of target business logic implementation.
Comments
Post a Comment