0

In spring batch remote chunking, consider a situation where the worker consumers are not available. In that case the manager publishes number of items equal to the throttle limit and waits for the reply from the workers. I have the receiveTimeout for the MessagingTemplate set to 5000. This loop from ChunkMessageChannelItemWriter write() is running infinitely because after every 5 seconds, the MessagingTemplate receive() timeout and returns null here. It doesn't perform anything if the result is null and thus falls into infinite loop.

In this scenario, the Job remains in an UNKNOWN state. Is there any way to perform the timeout from the manager end if it doesn't get any reply from the workers for some amount of time and mark the job as failed?

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Rahul Dey
  • 163
  • 2
  • 7

1 Answers1

0

Is there any way to perform the timeout from the manager end if it doesn't get any reply from the workers for some quite an amount of time and mark the job as failed?

You can set the maxWaitTimeouts on the ChunkMessageChannelItemWriter parameters for that.

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50
  • `maxWaitTimeouts` is applicable during `afterStep`. But this is happening during the `write()` which runs into an infinite loop. – Rahul Dey Jun 18 '21 at 10:50
  • Can you provide a [minimal example](https://stackoverflow.com/help/minimal-reproducible-example) that reproduces the issue? There is a remote-chunking sample with an embedded broker here: https://github.com/spring-projects/spring-batch/tree/main/spring-batch-samples/src/main/java/org/springframework/batch/sample/remotechunking. If you manage to create a sample that reproduces the issue with it, please open an issue on GitHub and add a reference to this SO question and I will take a look in details. – Mahmoud Ben Hassine Jun 21 '21 at 07:13