我正在读取多源读取器中的文件。我正在处理迭代处理器中的数据。在迭代处理器中,我想得到记录不正确的文件名。
我的工作配置: -
<batch:job id="FtpJob">
<batch:step id="step2">
<batch:tasklet transaction-manager="transactionManager">
<batch:chunk reader="multiResourceItemReader" processor="itemProcessor"
writer="databaseItemWriter" commit-interval="100">
</batch:chunk>
</batch:tasklet>
</batch:step>
</batch:job>
<bean id="multiResourceItemReader"
class="org.springframework.batch.item.file.MultiResourceItemReader">
<property name="resources"
value="file:C:/Users/Sandeep/Documents/New/*" />
<property name="delegate" ref="flatFileItemReader" />
</bean>
<!-- ItemReader reads a complete line one by one from input file -->
<bean id="flatFileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="lineMapper">
<bean
class="org.springframework.batch.item.file.mapping.PassThroughLineMapper">
</bean>
</property>
</bean>
<bean id="itemProcessor" class="Processor.itemProcessor"
scope="step">
</bean>
<!-- ItemWriter which writes data to database -->
<bean id="databaseItemWriter"
class="org.springframework.batch.item.database.HibernateItemWriter">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
我的物品处理器类: -
public class itemProcessor implements ItemProcessor<Object,Data> {
public Cdr process(Object singleLine) throws Exception
{
// here i want to know the record singleLine i am processing is of which file
// processing the code here
}
}