您好我们正在开发一个弹簧批处理,它处理SKU表中的所有SKU并向库存系统发送请求以获取库存详细信息。要发送到invetory详细信息,我们需要一次发送100个SKI ID,因此我们将pageSize设置为100.
读者日志中的: 我们看到
SELECT * FROM(SELECT S_ID,S_PRNT_PRD,SQ,ROWNUM为TMP_ROW_NUM FROM XXX_SKU WHERE SQ> =:min和SQ< =:max ORDER BY SQ ASC)WHERE ROWNUM< = 100]
但是我们在WRITER中观察到,在一定时间内发送了100个SKU,对于某些请求,只发送了1个SKU。
public void write(List<? extends XXXPagingBean> pItems) throws XXXSkipItemException {
if (mLogger.isLoggingDebug()) {
mLogger.logDebug("XXXInventoryServiceWriter.write() method STARTING, ItemsList size:{0}" +pItems.size());
}
....
....
}
XML中的Bean配置:
<!-- InventoryService Writer configuration -->
<bean id="inventoryGridService" class="atg.nucleus.spring.NucleusResolverUtil" factory-method="resolveName">
<constructor-arg value="/com/XXX/gigaspaces/inventorygrid/service/InventoryGridService" />
</bean>
<bean id="inventoryWriter" class="com.XXX.batch.integrations.XXXXXX.XXXXInventoryServiceWriter" scope="step">
<property name="jdbcTemplate" ref="batchDsTemplate"></property>
<property name="inventoryGridService" ref="inventoryGridService" />
</bean>
<bean id="pagingReader" class="org.springframework.batch.item.database.JdbcPagingItemReader" xmlns="http://www.springframework.org/schema/beans" scope="step">
<property name="dataSource" ref="dataSource" />
<property name="queryProvider">
<bean id=" productQueryProvider" class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="selectClause" value="select S_ID ,S_PRNT_PRD" />
<property name="fromClause" value="from XXX_SKU" />
<property name="sortKey" value="SEQ_ID" />
<property name="whereClause" value="SEQ_ID>=:min and SEQ_ID <=:max"></property>
</bean>
</property>
<property name="parameterValues">
<map>
<entry key="min" value="#{stepExecutionContext[minValue]}"></entry>
<entry key="max" value="#{stepExecutionContext[maxValue]}"></entry>
</map>
</property>
<property name="pageSize" value="100" />
<property name="rowMapper">
<bean class="com.XXX.batch.integrations.endeca.XXXPagingRowMapper"></bean>
</property>
</bean>
请建议。
答案 0 :(得分:0)
从productQueryProvider
bean定义中删除whereClause并删除parameterValues
,它应该可以正常工作。 PagingQueryProvider
会自动为您处理分页。没有必要亲自手动完成。