0

使用 AOP 的 RetryLogic 不适用于 MongoItemWritrer ,但同样适用于我的自定义 Readers 和 writers 我在这里做错了什么。

下面是代码片段。

<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>   

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

4

0 回答 0