AKB
AKB

Reputation: 5938

Mule multiple Batch processing

My flows are invoking multiple batch process. I want to process the batch in sequential i.e

Batch-1->Batch-2->Batch-3->...

<quartz:inbound-endpoint jobName="Fetch" repeatInterval="0" repeatCount="0" responseTimeout="10000" doc:name="Quartz" startDelay="5000">
    <quartz:event-generator-job/>
</quartz:inbound-endpoint>
<scatter-gather doc:name="Scatter-Gather">
    <processor-chain doc:name="Processor Chain">
        <batch:execute name="Batch-1" doc:name="Batch-1"/>
        <logger message="==Batch-1 END==" level="INFO" doc:name="Logger"/>
        <batch:execute name="Batch-2" doc:name="Batch-2"/>
     </processor-chain>
</scatter-gather>

Here, it goes to Batch-1, enters input state of batch-1, after end of input phase, thread comes to Batch-2 then input phase of Batch-2. It doesn't wait for Batch-1 different STEPS of each batch to complete and process the Batch-2. How do I handle this? I tried with two process chain each batch in process chains separately, it didn't work out. Without scatter gather I am facing same issue.

Batch flows:

<batch:job name="Batch-1">
    <batch:input>
        <logger message="==Invoke query====" level="INFO" doc:name="Logger"/>
    </batch:input>
    <batch:process-records>
        <batch:step name="Batch_Step">                
            <flow-ref name="sfdc-query" doc:name="Flow Reference"/>
        </batch:step>
    </batch:process-records>
    <batch:on-complete>
        <logger level="INFO" doc:name="Logger" message="On Complete:#[message.payload]"/>           
    </batch:on-complete>
</batch:job>

EDIT

Now, I have 5 process, A,B,C,D,E. It should process first A then next process is all of(B,C,D) in parallel. Once after B and D finishes, finally E should process. C can process parallel with B & D. How do map this?

Upvotes: 0

Views: 1690

Answers (1)

Star
Star

Reputation: 1503

In Batch-1 Oncomplete Phase, use VM call the second flow( Create new flow), in the second flow use batch Execute to call Batch-2.

Upvotes: 1

Related Questions