spring-batch

How can we make producer in spring amqp rabbitmq waiting after sending all messages and release upon receiving all?

让人想犯罪 __ 提交于 2019-12-12 01:36:25
问题 I am queuing all messages to rabbitmq queue and processing those on remote server. Below is my producer and reply handler in same class. public class AmqpAsynchRpcItemWriter<T> implements ItemWriter<T>, MessageListener { protected String exchange; protected String routingKey; protected String queue; protected String replyQueue; protected RabbitTemplate template; // Reply handler @Override public void onMessage(Message message) { try { String corrId = new String(message.getMessageProperties()

How to execute some partition step on all servers only once using spring batch partitioning?

一个人想着一个人 提交于 2019-12-12 01:33:15
问题 I am using spring batch partitioning. I read exchanges form files and do some processing for each exchange. exchanges are distributed over 4 servers to do parallel processing using spring batch partitioning. I have first step which prepares input files with exchange ids. I need to read these ids on all servers. Is there any way to run first step on all servers only once to prepare input files on all servers ? I tried by setting grid size = 4 (number of servers) and consumer concurrency 1 so

How to read data from Oracle Db using JdbcCursorItemReader with Multi threading

跟風遠走 提交于 2019-12-12 01:26:21
问题 I had spring batch application and configured step like this: ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setCorePoolSize(4); taskExecutor.setMaxPoolSize(10); taskExecutor.afterPropertiesSet(); return this.stepBuilderFactory.get("step1") .<Mymodel, Mymodel>chunk(2500) .reader(reader()) .writer(writer()) .taskExecutor(taskExecutor) .build(); And reader like this: @Bean public JdbcCursorItemReader<Mymodel> reader() { JdbcCursorItemReader<Mymodel> reader =

Spring Batch chunk size creating duplicates

心已入冬 提交于 2019-12-12 00:50:59
问题 I'm running a Spring batch job and whenever I increase the chunk size to anything greater than 1, lets say chunk size = n, it just duplicates the "nth" record "n" times instead of adding the n records. Below is my configuration, any pointers please? @Bean public JobLauncher jobLauncher(JobRepository jobRepository){ SimpleJobLauncher jobLauncher = new SimpleJobLauncher(); jobLauncher.setJobRepository(jobRepository); return jobLauncher; } @Bean public JobRepository jobRepository(DataSource

How to ensure all step partitions are finished before going into the next job step

谁说胖子不能爱 提交于 2019-12-11 23:03:09
问题 In my job I have a database export to csv which is partitioned. The next step merges those files into a single file using MultiResourceItemReader. My problem is that the files don't seem to be available when the merge step starts. I get this exception java.lang.IllegalStateException: No resources to read. Set strict=false if this is not an error condition. at org.springframework.batch.item.file.MultiResourceItemReader.open(MultiResourceItemReader.java:169) at org.springframework.batch.item

How does ChunkMessageChannelItemWriter collect replies in spring batch remote chunking?

五迷三道 提交于 2019-12-11 21:17:33
问题 I am trying to implement remote chunking in spring batch using spring integration and amqp (rabbitmq). I am not able to understand how does ChunkMessageChannelItemWriter collect replies in remote chunking test below https://github.com/spring-projects/spring-batch/blob/master/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkStepIntegrationTests-context.xml How does it work ? Does it send one message, wait for its reply, receives its reply and

How to send multiple emails using spring batch

只愿长相守 提交于 2019-12-11 20:44:42
问题 I need to send multiple emails to many users in my application using Spring Batch. I am new to Spring Batch. Need some pointers for it. 回答1: This Question is way to vague, so my answer will also have to be very vague. Spring Batch is based on Spring, so you can just use Spring's Email Support, read the corresponding section from the reference manual In Spring Batch, there are different places where you can register listeners, e.g. Jobs Steps Chunks Each of these listeners can be a custom

How to increase the performance of FlatFileItemReader in SpringBatch?

浪子不回头ぞ 提交于 2019-12-11 20:21:10
问题 I am writing spring batch which reads from flat file, do little processing and write the summary to the output file. My processor and writer are relatively quicker compared to reader. I am using FlatFileItemReader and tried with wide range of commit intervals starting from 50-1000. My batch job has to process 10 millions records on a faster rate. Kindly let me know the ways to improve the speed rate of FlatFileItemReader. pasting below my config file and my Mapper class read the fieldset and

Spring Cloud Task status shown as complete even when the batch job fails

谁说我不能喝 提交于 2019-12-11 19:47:53
问题 I have a task with 2 batch jobs, both jobs run but one of them fails. The status of the particular task is still shown as complete. i read about setting the spring.cloud.task.batch.failOnJobFailure property. When i set this property to true while running the task it gives me the following error: o.s.boot.SpringApplication : Application startup failed java.lang.AbstractMethodError: null at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:402) ~

Batch stuck due to metadata table value deletion

拥有回忆 提交于 2019-12-11 19:07:35
问题 My Spring batch application getting stuck when multiple batches run on same time with huge data. Getting the below exception Blocked resource ridlock fileid=1 pageid=69265493 dbid=6 id=lock2a36e0c00 mode=X associatedObjectId=72057594039631872 Blocked database ***** Blocking Host (User) ZNAPCDP1842V (myuser) Blocking application jTDS Blocking statement N/A Blocking batch/sp delete from BATCH_STEP_EXECUTION_SEQ where ID < 145678 I am using spring boot version - 1.2.5, Hibernate 4.3.5 I am NOT