Results 1 to 2 of 2

Thread: How to configure a flow decision

  1. #1
    Join Date
    Dec 2006
    Posts
    7

    Default How to configure a flow decision

    Hi

    I'm struggling to configure a decision flow in my job definition. The job is triggered with TaskExecutorPartitionHandler. We are reading all the file's in from a directory. The files are processed in there own step and the configuration for reading the file is done with lazy binding.
    In the directory we get files which can't be processed(wrong format) and has to be put in a error directory. The files which has been succesfuly processed are put in the done directory.

    The current configuration I use:
    Code:
    ...
     <!--Externalize the flow definition-->
        <b:flow id="oneBansta">
            <b:step id="bansta2Processing" >
                <b:tasklet>
                    <b:chunk reader="segmentgroupreader" processor="segmentGroupProcessor" writer="segmentGroupWriter" commit-interval="5">
                    </b:chunk>
                </b:tasklet>
                <b:next on="*" to="moveToDoneTasklet"/>
                <b:next on="ERROR" to="moveToErrorTasklet"/>
            </b:step>
        </b:flow>
    
        <!-- job definition, using the batch namespace -->
    
        <b:job id="completeJob">
            <!--"Transition point need all the file(s) in a directory to process"-->
            <b:flow id="completeJob.oneBanstaFlow" parent="oneBansta"/>
        </b:job>
    ...

    After reading the book, we tought the decision flow is a good feature to handle this. I tried a few configurations and get exceptions:

    Caused by: java.lang.IllegalArgumentException: Missing state for [StateTransition: [state=completeJob.oneBanstaFlow.bansta2Processing, pattern=*, next=completeJob.oneBanstaFlow.moveToDoneTasklet]]

    If I define a decision I get the following ERROR.
    Code:
            
     <b:job id="completeJob">
            <!--"Transition point need all the file(s) in a directory to process"-->
            <b:flow id="completeJob.oneBanstaFlow" parent="oneBansta"/>
     <b:decision id="whatEverDecision" decider="outcomeDecider">
                <b:end on="*"/>
                <b:next on="ERROR" to="moveToErrorTasklet"/>
            </b:decision>
    ...
    ...
    Caused by: org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: The element [whatEverDecision] is unreachable
    Offending resource: class path resource [jobs/complete/complete-jobTest.xml]


    Any advise would be helpfull so we could solve the problem.
    Regards Dirk

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    "Missing state for..." means there is a transition but no state defined for it to land on. Your job as it stands in the first code snippet clearly has no state called "moveToDoneTasklet" so that makes sense. Maybe you didn't post all the steps?

    The "unreachable..." error also is pretty explicit: you have added a state to your job (the decision in this case) to which there are no transitions declared. Somewhere in there you need a next="whatEverDecision".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •