Announcement Announcement Module
No announcement yet.
Conditional Flow on partitioned steps Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditional Flow on partitioned steps

    I'm having some troubles applying some conditional flow to a partitioned step. I have a listener applied to my master step which is being processed correctly and from this listener I am able to determine the correct process flow. However my end, fail and next tags are being ignored. I'm not sure I've got them in the correct place, but they are in the only place that seems appropriate.

    I have this step (within a larger set of steps):
    <step id="ftpUrlProcessUploadStep" parent="ftpUrlLogUploadStep:master" >
        <end on="COMPLETED" />
        <fail on="FAILED" exit-code="Step failed"/>
        <next on="*" to="ftpProcessUploadStep" />
    and on my master step I have:
    <bean name="ftpUrlLogUploadStep:master" class="">
        <property name="partitionHandler" ref="ftpUrlLogUploadPartitionHandler"/>
        <property name="stepExecutionSplitter" ref="ftpUrlLogUploadExecutionSplitter"/>
        <property name="jobRepository" ref="jobRepository" />
        <property name="stepExecutionListeners">
                <ref bean="ftpProcessUploadStepListener" />
    <step id="ftpUrlLogUploadStep" xmlns="">
        <tasklet ref="ftpUrlLogUploadRemoteTasklet" />
    <bean id="ftpProcessUploadStepListener" class=""/>
    In my listener I am returning either of these status depending on what I need to do:
    new ExitStatus("CONTINUE")
    My question is are my end, fail and next tags in the correct place? If not where are they supposed to go? It doesn't matter what I return from my listener the step always follows the same flow.

  • #2
    you probably need to put the listener on the actual step and not the step materializing the partition.


    • #3
      I had tried this but it's not really what I'm after. I can't add it to the main ftpUrlProcessUploadStep as it has no tasklet tags and I can't add a listener to the step tags (yet), then if I add it to the ftpUrlLogUploadStep this is the individual step that is created for each partition. What I'm trying to do is check the result of the step after the partitions are aggregated and Batch has set the ExitStatus for the step as a whole.

      In the bigger picture we have the problem where sometimes we hit the partition step and have nothing to process resulting in an exception IllegalArgumentException: Cannot aggregate empty or null executions: []. In our case this is legitimate and we wan't to continue. We have a workaround where we are extending the DefaultStepExecutionAggregator but I was hoping to have a solution that didn't involve us having to extend classes and potentially have more to maintain.

      Guess we'll have to wait for v3.0 where listener supports is being added to partitioned steps.


      • #4
        Right. my mistake. You need to put the listener on the partition step. You don't need to wait for 3.0. We had the same need and requested the addition. You could use an abstract step and set a parent on your partition step and it will work.

        My colleague has posted a working example over here: