cancel
Showing results for 
Search instead for 
Did you mean: 

service tasks are started multiple times

ytsudhamathi
Champ in-the-making
Champ in-the-making

Same workflow is started multiple times in parallel stream, causes the service task to execute multiple time. How to resolve this issue. Thanks in advance.

2 REPLIES 2

EddieMay
World-Class Innovator
World-Class Innovator

Hi @ytsudhamathi & welcome to Alfresco!

We are going to need some more information about the workflow, how it's written and when its called, etc, + some log output if possible. Take a look at the guidance for posting.

Thanks,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

My workflow is as follow:

And using AsyncJobExecutor to execute the jobs.

Thank you.

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="FulfillmentTransactionWorkflow" name="Fulfillment Transaction Workflow" isExecutable="true">
    <subProcess id="transactionProcessingSP" name="Transaction Processing" activiti:async="true">
      <startEvent id="startInnerTransactionSE" name="Start"></startEvent>
      <sequenceFlow id="flow1" sourceRef="startInnerTransactionSE" targetRef="requestPlanConfigurationST"></sequenceFlow>
      <serviceTask id="checkHoldStatusST" activiti:async="true" name="Check Hold Status" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action2"></serviceTask>
      <sequenceFlow id="flow2" name="Error Ocurred?" sourceRef="checkHoldStatusST" targetRef="checkHoldStatusErrorEG"></sequenceFlow>
      <exclusiveGateway id="checkHoldStatusEG" name="Check Hold Status Exclusive Gateway"></exclusiveGateway>
      <sequenceFlow id="flow3" name="No" sourceRef="checkHoldStatusEG" targetRef="generateDitaOtOutputST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "false"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow22" name="Yes" sourceRef="checkHoldStatusEG" targetRef="handleHeldTransactionEventST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "true"}]]></conditionExpression>
      </sequenceFlow>
      <serviceTask id="requestPlanConfigurationST" activiti:async="true" name="Request Plan Configuration" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action3"></serviceTask>
      <sequenceFlow id="flow6" name="Error Occurred?" sourceRef="requestPlanConfigurationST" targetRef="requestPlanConfigurationEG"></sequenceFlow>
      <endEvent id="endInnerTransactionEE" name="End"></endEvent>
      <exclusiveGateway id="requestPlanConfigurationEG" name="Request Plan Configuration Exclusive Gateway"></exclusiveGateway>
      <sequenceFlow id="flow7" name="No" sourceRef="requestPlanConfigurationEG" targetRef="feedGenerationSP">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "false"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow18" name="Yes" sourceRef="requestPlanConfigurationEG" targetRef="requestPlanConfigurationErrorST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "true"}]]></conditionExpression>
      </sequenceFlow>
      <exclusiveGateway id="generateFeedEG" name="Generate Feed Exclusive Gateway"></exclusiveGateway>
      <sequenceFlow id="flow17" name="No" sourceRef="generateFeedEG" targetRef="checkHoldStatusST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "false"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow20" name="Yes" sourceRef="generateFeedEG" targetRef="generateFeedErrorST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "true"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow16" name="Error Occurred?" sourceRef="feedGenerationSP" targetRef="generateFeedEG"></sequenceFlow>
      <serviceTask id="requestPlanConfigurationErrorST" activiti:async="true" name="Handle Error" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action4"></serviceTask>
      <sequenceFlow id="flow19" sourceRef="requestPlanConfigurationErrorST" targetRef="endDueToRequestPlanConfigurationErrorEEE"></sequenceFlow>
      <endEvent id="endDueToRequestPlanConfigurationErrorEEE" name="ErrorEnd">
        <errorEventDefinition errorRef="REQUEST_PLAN_CONFIGURATION_ERROR"></errorEventDefinition>
      </endEvent>
      <serviceTask id="generateFeedErrorST" activiti:async="true" name="Handle Error" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action4"></serviceTask>
      <sequenceFlow id="flow24" sourceRef="generateFeedErrorST" targetRef="endDueToGenerateFeedErrorEEE"></sequenceFlow>
      <endEvent id="endDueToGenerateFeedErrorEEE" name="ErrorEnd">
        <errorEventDefinition errorRef="GENERATE_FEED_ERROR"></errorEventDefinition>
      </endEvent>
      <serviceTask id="handleHeldTransactionEventST" activiti:async="true" name="Handle Held Transaction Event" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action4"></serviceTask>
      <sequenceFlow id="flow23" sourceRef="handleHeldTransactionEventST" targetRef="endDueToTransactionHeldEEE"></sequenceFlow>
      <endEvent id="endDueToTransactionHeldEEE" name="ErrorEnd">
        <errorEventDefinition errorRef="HELD_ERROR"></errorEventDefinition>
      </endEvent>
      <exclusiveGateway id="checkHoldStatusErrorEG" name="Check Hold Status Error Exclusive Gateway"></exclusiveGateway>
      <sequenceFlow id="flow25" name="Transaction Held?" sourceRef="checkHoldStatusErrorEG" targetRef="checkHoldStatusEG">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "false"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow26" name="Yes" sourceRef="checkHoldStatusErrorEG" targetRef="checkHoldStatusErrorST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "true"}]]></conditionExpression>
      </sequenceFlow>
      <serviceTask id="checkHoldStatusErrorST" activiti:async="true" name="Handle Error" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action4"></serviceTask>
      <sequenceFlow id="flow27" sourceRef="checkHoldStatusErrorST" targetRef="endDueToCheckHoldStatusEEE"></sequenceFlow>
      <endEvent id="endDueToCheckHoldStatusEEE" name="ErrorEnd">
        <errorEventDefinition errorRef="CHECK_HOLD_STATUS_FEED_ERROR"></errorEventDefinition>
      </endEvent>
      <subProcess id="feedGenerationSP" name="Feed Generation">
        <startEvent id="startFeedGenerationSE" name="Start"></startEvent>
        <endEvent id="endFeedGenerationEE" name="End"></endEvent>
        <serviceTask id="generateBenefitVariablesST" activiti:async="true" name="Generate Benefit Variables" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action5"></serviceTask>
        <serviceTask id="generateDitavalST" activiti:async="true" name="Generate Ditaval" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action6"></serviceTask>
        <serviceTask id="executeRulesEvaluatorST" activiti:async="true" name="Execute Rules Evaluator" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action7"></serviceTask>
        <serviceTask id="generateCirrusVariablesST" activiti:async="true" name="Generate Cirrus Variables" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action8"></serviceTask>
        <serviceTask id="identifySeriesST" activiti:async="true" name="Identify Series" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action9"></serviceTask>
        <serviceTask id="assembleCompendiumConfigurationST" activiti:async="true" name="Assemble Compendium Configuration" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action10"></serviceTask>
        <serviceTask id="generateDitaMapST" activiti:async="true" name="Generate DitaMap" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action11"></serviceTask>
        <sequenceFlow id="flow29" sourceRef="startFeedGenerationSE" targetRef="generateBenefitVariablesST"></sequenceFlow>
        <sequenceFlow id="flow30" sourceRef="generateBenefitVariablesST" targetRef="generateDitavalST"></sequenceFlow>
        <sequenceFlow id="flow31" sourceRef="generateDitavalST" targetRef="executeRulesEvaluatorST"></sequenceFlow>
        <sequenceFlow id="flow32" sourceRef="executeRulesEvaluatorST" targetRef="generateCirrusVariablesST"></sequenceFlow>
        <sequenceFlow id="flow33" sourceRef="generateCirrusVariablesST" targetRef="identifySeriesST"></sequenceFlow>
        <sequenceFlow id="flow34" sourceRef="identifySeriesST" targetRef="assembleCompendiumConfigurationST"></sequenceFlow>
        <sequenceFlow id="flow35" sourceRef="assembleCompendiumConfigurationST" targetRef="generateDitaMapST"></sequenceFlow>
        <sequenceFlow id="flow36" sourceRef="generateDitaMapST" targetRef="endFeedGenerationEE"></sequenceFlow>
      </subProcess>
      <serviceTask id="generateDitaOtOutputST" activiti:async="true" name="Generate DitaOt Output" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action12"></serviceTask>
      <exclusiveGateway id="generateOutputEG" name="Generate Output Exclusive Gateway"></exclusiveGateway>
      <serviceTask id="generateOutputErrorST" activiti:async="true" name="Handle Error" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action4"></serviceTask>
      <endEvent id="endDueToGenerateOutputErrorEEE" name="ErrorEnd">
        <errorEventDefinition></errorEventDefinition>
      </endEvent>
      <callActivity id="edmsDelivery" name="EDMS Delivery" calledElement="DeliveryWorkflow">
        <extensionElements>
          <activiti:in source="rsuite contents" target="rsuite contents"></activiti:in>
          <activiti:in source="sourceId" target="sourceId"></activiti:in>
          <activiti:in source="rsuiteId" target="rsuiteId"></activiti:in>
          <activiti:in source="skey" target="skey"></activiti:in>
          <activiti:in source="deliverySystemType" target="deliverySystemType"></activiti:in>
          <activiti:in source="fulfillmentWorkingFolder" target="rsuiteWorkingFolderPath"></activiti:in>
          <activiti:in source="userId" target="userId"></activiti:in>
          <activiti:in sourceExpression="delivery" target="WorkflowPoolName"></activiti:in>
          <activiti:in source="fileSystemArtifacts" target="fileSystemArtifacts"></activiti:in>
          <activiti:in source="pubtrackId" target="pubtrackId"></activiti:in>
          <activiti:in source="processId" target="processId"></activiti:in>
          <activiti:in source="planId" target="planId"></activiti:in>
          <activiti:in source="memberGroupId" target="memberGroupId"></activiti:in>
          <activiti:in source="planType" target="planType"></activiti:in>
          <activiti:in source="material_id" target="material_id"></activiti:in>
        </extensionElements>
      </callActivity>
      <exclusiveGateway id="deliveryEG" name="Delivery Exclusive Gateway"></exclusiveGateway>
      <serviceTask id="deliveryErrorST" activiti:async="true" name="Handle Error" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action4"></serviceTask>
      <endEvent id="endDueToDeliveryErrorEEE" name="ErrorEnd">
        <errorEventDefinition></errorEventDefinition>
      </endEvent>
      <sequenceFlow id="flow37" sourceRef="generateDitaOtOutputST" targetRef="generateOutputEG"></sequenceFlow>
      <sequenceFlow id="flow38" sourceRef="generateOutputEG" targetRef="generateOutputErrorST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "true"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow39" sourceRef="generateOutputErrorST" targetRef="endDueToGenerateOutputErrorEEE"></sequenceFlow>
      <sequenceFlow id="flow40" sourceRef="generateOutputEG" targetRef="edmsDelivery">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "false"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow41" sourceRef="edmsDelivery" targetRef="deliveryEG"></sequenceFlow>
      <sequenceFlow id="flow42" sourceRef="deliveryEG" targetRef="deliveryErrorST">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "true"}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow43" sourceRef="deliveryErrorST" targetRef="endDueToDeliveryErrorEEE"></sequenceFlow>
      <sequenceFlow id="flow44" sourceRef="deliveryEG" targetRef="endInnerTransactionEE">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${EXCEPTION_OCCUR == "false"}]]></conditionExpression>
      </sequenceFlow>
    </subProcess>
    <startEvent id="startOuterTransactionSE" name="Start"></startEvent>
    <sequenceFlow id="flow28" sourceRef="startOuterTransactionSE" targetRef="transactionProcessingSP"></sequenceFlow>
    <boundaryEvent id="transactionProcessingEBE" name="Error" attachedToRef="transactionProcessingSP">
      <errorEventDefinition></errorEventDefinition>
    </boundaryEvent>
    <endEvent id="endOuterTransactionSE" name="End"></endEvent>
    <exclusiveGateway id="transactionEG" name="Transaction Exclusive Gateway"></exclusiveGateway>
    <serviceTask id="notifyBatchST" activiti:async="true" name="Notify Batch" activiti:class="com.rsicms.wfpoolingtest.actionhandler.ServiceTask1Action14"></serviceTask>
    <sequenceFlow id="flow45" sourceRef="transactionProcessingSP" targetRef="transactionEG"></sequenceFlow>
    <sequenceFlow id="flow46" sourceRef="transactionProcessingEBE" targetRef="transactionEG"></sequenceFlow>
    <sequenceFlow id="flow47" sourceRef="transactionEG" targetRef="notifyBatchST"></sequenceFlow>
    <sequenceFlow id="flow48" sourceRef="notifyBatchST" targetRef="endOuterTransactionSE"></sequenceFlow>
    <dataObject id="one" name="EXCEPTION_OCCUR" itemSubjectRef="xsd:string">
      <extensionElements>
        <activiti:value>false</activiti:value>
      </extensionElements>
    </dataObject>
  </process>
</definitions>