使用 Spring Batch 和 SFTP 安全的傳送資料
阿新 • • 發佈:2019-01-23
使用 Spring Batch 構建企業級批處理應用: 第 1 部分
JdbcPagingItemReader分頁讀對賬檔案 <beans:bean id="updateSqlProvider" class="org.springframework.batch.item.database.support.MySqlPagingQueryProvider">
<beans:property name="selectClause" value="t.id,t.sql,t.sqlDetail,t.validateSql,t.validateResult,t.status,t.statusDetail,t.version,t.doTime"></beans:property>
<beans:property name="fromClause" value="t_db_validate t"></beans:property>
<beans:property name="whereClause" value="t.status=0"></beans:property>
<beans:property name="sortKey" value="t.id" />
</beans:bean>
<bean id="pagingItemReader" class="org.springframework.batch.item.database.JdbcPagingItemReader"scope="step"> <property name="dataSource" ref="dataSource" /> <property name="queryProvider"> <bean class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="selectClause"value="select id, user_login, user_pass, age" /> <property name="fromClause" value="from users" /> <property name="whereClause" value="where id >= :fromId and id <= :toId" /> <property name="sortKey" value="id" /> </bean> </property> <!-- Inject via the ExecutionContext in rangePartitioner --> <property name="parameterValues"> <map> <entry key="fromId" value="#{stepExecutionContext[fromId]}" /> <entry key="toId" value="#{stepExecutionContext[toId]}" /> </map> </property> <property name="pageSize" value="10" /> <property name="rowMapper"> <bean class="com.mkyong.UserRowMapper" /> </property> </bean>
監控job
FTP DEMO