Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
223 lines (197 sloc) 9.93 KB
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<job id="elixir0ImportJob" restartable="true" xmlns="http://www.springframework.org/schema/batch">
<validator ref="elixir0ImportJobParametersValidator" />
<step id="elixir0LoadStep">
<tasklet>
<chunk reader="elixir0LoadReader" writer="hibernateItemWriter" commit-interval="5" />
</tasklet>
<next on="COMPLETED" to="scalingStrategyDecision" />
<fail on="FAILED"/>
</step>
<decision id="scalingStrategyDecision" decider="scalingStrategyDecider">
<next on="CHUNKING" to="paymentSanctionScreeningStep.chunking" />
<next on="PARTITIONING" to="paymentSanctionScreeningStep.partitioning" />
<next on="REMOTE_CHUNKING" to="paymentSanctionScreeningStep.remoteChunking" />
<next on="REMOTE_PARTITIONING" to="paymentSanctionScreeningStep.remotePartitioning.MASTER" />
</decision>
<step id="paymentSanctionScreeningStep.chunking">
<tasklet task-executor="executor" throttle-limit="8">
<chunk reader="paymentSanctionScreeningReader.chunking" processor="paymentSanctionScreeningProcessor"
writer="hibernateItemWriter" commit-interval="5"/>
</tasklet>
<next on="COMPLETED" to="updateScreenedTransactionStatusStep" />
<fail on="FAILED" />
<listeners>
<listener ref="paymentSanctionScreeningRecoveryCleaner" />
</listeners>
</step>
<step id="paymentSanctionScreeningStep.partitioning">
<partition partitioner="moduloPartitioner">
<step>
<tasklet throttle-limit="1">
<chunk reader="paymentSanctionScreeningReader.partitioning" processor="paymentSanctionScreeningProcessor"
writer="hibernateItemWriter" commit-interval="5"/>
</tasklet>
</step>
<handler task-executor="executor" grid-size="8" />
</partition>
<next on="COMPLETED" to="updateScreenedTransactionStatusStep" />
<fail on="FAILED" />
</step>
<step id="paymentSanctionScreeningStep.remoteChunking">
<tasklet>
<chunk reader="paymentSanctionScreeningReader.remoteChunking" processor="paymentSanctionScreeningProcessor"
writer="hibernateItemWriter" commit-interval="5" />
</tasklet>
<next on="COMPLETED" to="updateScreenedTransactionStatusStep" />
<fail on="FAILED" />
<listeners>
<listener ref="paymentSanctionScreeningRecoveryCleaner" />
</listeners>
</step>
<step id="paymentSanctionScreeningStep.remotePartitioning.MASTER">
<partition partitioner="moduloPartitioner" handler="JMSPartitionHandler" step="paymentSanctionScreeningStep.remotePartitioning.PARTITION" />
<next on="COMPLETED" to="updateScreenedTransactionStatusStep" />
<fail on="FAILED" />
</step>
<step id="updateScreenedTransactionStatusStep">
<tasklet ref="updateScreenedTransactionStatusTasklet" />
<end on="COMPLETED" />
<fail on="FAILED" />
</step>
</job>
<step id="paymentSanctionScreeningStep.remotePartitioning.PARTITION" xmlns="http://www.springframework.org/schema/batch">
<tasklet throttle-limit="1">
<chunk reader="paymentSanctionScreeningReader.partitioning" processor="paymentSanctionScreeningProcessor"
writer="hibernateItemWriter" commit-interval="5" />
</tasklet>
</step>
<bean id="elixir0LoadReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
<property name="resource" value="file:#{jobParameters['inputFile']}" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="names" value="#{T(com.ontheserverside.batch.bank.processing.Elixir0Mapper).COLUMN_NAMES}" />
</bean>
</property>
<property name="fieldSetMapper">
<bean class="com.ontheserverside.batch.bank.processing.Elixir0Mapper" />
</property>
</bean>
</property>
</bean>
<bean id="paymentSanctionScreeningReader.chunking" class="com.ontheserverside.batch.bank.processing.SynchronizedItemReaderDecorator">
<constructor-arg>
<bean class="org.springframework.batch.item.database.HibernateCursorItemReader">
<property name="sessionFactory" ref="sessionFactory" />
<property name="useStatelessSession" value="false" />
<property name="saveState" value="false" />
<property name="queryString">
<value>
SELECT NEW com.ontheserverside.batch.bank.screening.SanctionScreeningContext (tx, entity)
FROM Elixir0Transaction tx, SDNEntity entity
WHERE tx.status = :txStatus
ORDER BY tx.id
</value>
</property>
<property name="parameterValues">
<map>
<entry key="txStatus" value="#{T(com.ontheserverside.batch.bank.tx.TransactionStatus).LOADED}"/>
</map>
</property>
</bean>
</constructor-arg>
</bean>
<bean id="paymentSanctionScreeningReader.remoteChunking" class="org.springframework.batch.item.database.HibernateCursorItemReader">
<property name="sessionFactory" ref="sessionFactory" />
<property name="useStatelessSession" value="false" />
<property name="saveState" value="false" />
<property name="queryString">
<value>
SELECT NEW com.ontheserverside.batch.bank.screening.SanctionScreeningContext (tx, entity)
FROM Elixir0Transaction tx, SDNEntity entity
WHERE tx.status = :txStatus
ORDER BY tx.id
</value>
</property>
<property name="parameterValues">
<map>
<entry key="txStatus" value="#{T(com.ontheserverside.batch.bank.tx.TransactionStatus).LOADED}"/>
</map>
</property>
</bean>
<bean id="paymentSanctionScreeningReader.partitioning" scope="step" class="org.springframework.batch.item.database.HibernateCursorItemReader">
<property name="sessionFactory" ref="sessionFactory" />
<property name="useStatelessSession" value="false" />
<property name="saveState" value="false" />
<property name="queryString">
<value>
SELECT NEW com.ontheserverside.batch.bank.screening.SanctionScreeningContext (tx, entity)
FROM Elixir0Transaction tx, SDNEntity entity
WHERE tx.status = :txStatus
AND mod(tx.id, :modDivisor) = :modRemainder
ORDER BY tx.id
</value>
</property>
<property name="parameterValues">
<map>
<entry key="modDivisor" value="#{stepExecutionContext['mod.divisor']}" />
<entry key="modRemainder" value="#{stepExecutionContext['mod.remainder']}" />
<entry key="txStatus" value="#{T(com.ontheserverside.batch.bank.tx.TransactionStatus).LOADED}"/>
</map>
</property>
</bean>
<bean id="paymentSanctionScreeningRecoveryCleaner" class="com.ontheserverside.batch.bank.screening.SanctionScreeningRecoveryCleaner" />
<bean id="paymentSanctionScreeningProcessor" class="com.ontheserverside.batch.bank.screening.SanctionScreeningProcessor" />
<bean id="hibernateItemWriter" class="org.springframework.batch.item.database.HibernateItemWriter">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="scalingStrategyDecider" class="com.ontheserverside.batch.bank.processing.JobParameterExecutionDecider">
<property name="jobParameterKey" value="scalingStrategy" />
</bean>
<bean id="moduloPartitioner" class="com.ontheserverside.batch.bank.processing.ModuloPartitioner" />
<bean id="elixir0ImportJobParametersValidator" class="org.springframework.batch.core.job.DefaultJobParametersValidator">
<property name="requiredKeys">
<list>
<value>inputFile</value>
<value>scalingStrategy</value>
</list>
</property>
</bean>
<bean id="chunkHandler" class="org.springframework.batch.integration.chunk.RemoteChunkHandlerFactoryBean">
<property name="chunkWriter" ref="chunkWriter" />
<property name="step" ref="paymentSanctionScreeningStep.remoteChunking" />
</bean>
<bean id="chunkWriter" class="org.springframework.batch.integration.chunk.ChunkMessageChannelItemWriter" scope="step">
<property name="messagingOperations">
<bean class="org.springframework.integration.core.MessagingTemplate">
<property name="defaultChannel" ref="screening.requests.chunking" />
<property name="receiveTimeout" value="1000" />
</bean>
</property>
<property name="replyChannel" ref="screening.replies.chunking" />
<property name="maxWaitTimeouts" value="10" />
</bean>
<bean id="JMSPartitionHandler" class="org.springframework.batch.integration.partition.MessageChannelPartitionHandler">
<property name="stepName" value="paymentSanctionScreeningStep.remotePartitioning.PARTITION" />
<property name="gridSize" value="8" />
<property name="messagingOperations">
<bean class="org.springframework.integration.core.MessagingTemplate">
<property name="defaultChannel" ref="screening.requests.partitioning"/>
</bean>
</property>
<property name="replyChannel" ref="screening.replies.partitioning" />
</bean>
<bean id="stepExecutionRequestHandler" class="org.springframework.batch.integration.partition.StepExecutionRequestHandler">
<property name="jobExplorer" ref="jobExplorer" />
<property name="stepLocator">
<bean class="org.springframework.batch.integration.partition.BeanFactoryStepLocator" />
</property>
</bean>
<bean id="updateScreenedTransactionStatusTasklet" class="com.ontheserverside.batch.bank.screening.UpdateScreenedTransactionStatusTasklet" />
</beans>