Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Workflow triggering taking more time using java api

Hi

We have migrated from MDM 7.1 SP04 to MDM 7.1 SP12.

When we try to trigger workflow for single record in MDM jav api is returning after approx 50 - 90 seconds.

Where as in SP04 it took just 2 seconds to complete workflow.

Below is the code snippet (method) for the same. Please verify the cause for the delay thoguh workflow launched successfully.

private static void triggerWorkFlow(SimpleConnection connection,

            String userSession, TableId tableId, List<RecordId> recordIds,

            Logger output) throws Exception {

        try {

            RetrieveWorkflowsCommand retriveworksFlows = new RetrieveWorkflowsCommand(

                    connection);

            retriveworksFlows.setSession(userSession);

            retriveworksFlows.setTableId(tableId);

            retriveworksFlows.execute();

            WorkflowProperties[] workflowpro = retriveworksFlows.getWorkflows();

            WorkflowId workflowId = null;

            for (int n = 0; n < workflowpro.length; n++) {

                if ("W_ASSIGNMENTS_TITLE".equalsIgnoreCase(workflowpro[n]

                        .getCode())) {

                    workflowId = workflowpro[n].getId();

                    output.info("Title workflow retrieved<<MT.");

                    break;

                }

            }

            // System.out.println("Identified workflow is ==> "+workflowId);

            CreateWorkflowJobCommand workflowjobcommand = new CreateWorkflowJobCommand(

                    connection);

            workflowjobcommand.setWorkflowId(workflowId);

            workflowjobcommand.setRecordIds(recordIds.toArray(new RecordId[0]));

            workflowjobcommand.setSession(userSession);

         

            workflowjobcommand.execute();

            WorkflowJobId jobId = workflowjobcommand.getWorkflowJobId();

              

// commented in SP12

         

/* LaunchWorkflowJobCommand launcher = new LaunchWorkflowJobCommand(

                    connection);

            launcher.setSession(userSession);

            launcher.setJobId(jobId);

            launcher.execute();     */

           

            output.info("  Workflow successfully launched<<."+jobId);

        } catch (Exception ex) {

            ex.printStackTrace();

            throw ex;

        }

    }

Not what you were looking for? View more on this topic or Ask a question