[英]Implement SkippableTasklet in Spring batch remote chunking with Chunk Oriented Processing
我目前正在使用Spring Batch,並且想使用遠程分塊。
我使用面向面向塊的處理,該處理使用項目讀取器,項目處理器和項目寫入器,並希望實現跳過。
我在這看問題,這讓我創造SkippableTasklet
但我有點迷惑如何實現protected abstract void run(JobParameters jobParameters) throws Exception;
如何在此遠程分塊實現中實現跳過?
有幾種方法可以處理可跳過的異常。 我是這樣寫的
<batch:step id="sendEmailStep">
<batch:tasklet>
<bean class="com.myproject.SendEmail" scope="step" autowire="byType">
<batch:skippable-exception-classes>
<batch:include class="org.springframework.mail.MailException" />
</batch:skippable-exception-classes>
</bean>
</batch:tasklet>
<batch:listeners>
batch:listener ref="skippableListener'/>
</batch:listeners>
</batch:step>
<bean id="skippableListener" class="SkippableListener/>
public class SkippableListener implements SkipListener
{
void onSkipInProcess(T item, java.lang.Throwable t){
//Write your logic
};
void onSkipInRead(java.lang.Throwable t){
//Write your logic
};
void onSkipInWrite(S item, java.lang.Throwable t){
//Write your logic
};
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.