使用AOP的RetryLogic不适用于MongoItemWritrer,但同样适用于我的自定义读者和编写者

时间:2016-04-01 16:12:01

标签: spring-batch retrypolicy

使用AOP的RetryLogic不适用于MongoItemWritrer,但同样适用于我的自定义读者和编写者 在这里有什么我做错了。

以下是代码片段。                       

<bean id="retryAdvice"
class="org.springframework.retry.interceptor.RetryOperationsInterceptor">
    <property name="retryOperations" ref="taskBatchRetryTemplate" />
</bean>
<bean id="taskBatchRetryTemplate" class="org.springframework.retry.support.RetryTemplate">
    <property name="retryPolicy" ref="genericRetryPolicy" />
    <property name="backOffPolicy">             
        <bean class="org.springframework.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="${mongoloader.backOffPeriod.initialInterval}"/>
            <property name="maxInterval" value="${mongoloader.backOffPeriod.maxInterval}"/>
            <property name="multiplier" value="${mongoloader.backOffPeriod.multiplier}"/>
        </bean>
    </property>
    <property name="listeners">
        <bean class="com.company.ens.myload.job.StepRetryListener"/>
    </property>
</bean>

<bean id="genericRetryPolicy" class="org.springframework.retry.policy.SimpleRetryPolicy"  >
    <constructor-arg index="0" value="${mongoloader.retry.limit}"/>
    <constructor-arg index="1">
        <map>
            <entry key="org.springframework.data.mongodb.CannotGetMongoDbConnectionException" value="true"/>
            <entry key="org.springframework.jdbc.CannotGetJdbcConnectionException" value="true"/>               
            <!--  Just included the below exception for testing purpose, needs to be removed -->
            <entry key="java.io.FileNotFoundException" value="true"/>               
            <entry key="org.springframework.dao.DuplicateKeyException" value="true"/>               
        </map>
    </constructor-arg>
</bean> 


//including only my step configution here
<batch:step id="Step4a-MainFlow_TranslateRawFedObjectsToFilingModel"
                allow-start-if-complete="false">                                
                <batch:tasklet>
                    <batch:chunk reader="rawFedObjectMongoReader"
                        processor="translatingProcessor" writer="SctModelMongoWriter"
                        commit-interval="100"/>
                </batch:tasklet>
                <batch:listeners>
                    <batch:listener ref="step4aListener"/>
                </batch:listeners>
</batch:step>   

未找到与我的问题相关的任何帖子。任何帮助将不胜感激。

0 个答案:

没有答案