Thank you all for sharing your feedback and suggestion.
Let me first explain my scenerio first,as it is making some confussion here.
Our service receiving document with iteration of 5000(avg document size)records count.Now ,we have to process individual record.Again to process individual record there is 4-5 step is need to check record in background DB and then make update/Insert as well some others condition checking also.
So,If we process all the records in the main service within a single loop and process individual record then it will take much processing time.In this situation ,my idea was to divide the whole record into some small group and publish the individual list as a unit for prallel processing.
you are correct that some loop is required either in java or in flow service,but I think using java service some how performance can be good if we can use arrayCopy method instaed instead of using loop or repeat operation.
Can you please share some background code logic for ps.util.list:getSubArray/pub.document:groupDocuments if you have or if theres any hidden way to extract the same.
We have written below code set to return smaller block from input document list and starting index for retriving the document will be maintained in original service in repeat step.
batchSize,startIndex,listName...as String variable
IDataCursor pipelineCursor = pipeline.getCursor();
String batchSize = IDataUtil.getString( pipelineCursor, "batchSize" );
String startIndex = IDataUtil.getString( pipelineCursor, "startIndex" );
String listName = IDataUtil.getString( pipelineCursor, "listName" );
IData inputList = IDataUtil.getIDataArray( pipelineCursor, "inputList" );
if ( inputList != null)
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IData outPut = IDataFactory.create();
IDataCursor outPutCursor = outPut.getCursor();
IData tempList = new IData[Integer.parseInt(batchSize)];
System.arraycopy(inputList, Integer.parseInt(startIndex), tempList, 0, Integer.parseInt(batchSize));
IDataUtil.put( outPutCursor, listName, tempList );
IDataUtil.put( pipelineCursor_1, "outPut", outPut );
Please share your feed-back for the same