@Procedure @PerformsWrites @Description("apoc.periodic.iterate('statement returning items', 'statement per item', {batchSize:1000,parallel:true}) YIELD batches, total - run the second statement for each item returned by the first statement. Returns number of batches and total processed rows") public Stream<BatchAndTotalResult> iterate(@Name("cypherIterate") String cypherIterate,@Name("cypherAction") String cypherAction,@Name("config") Map<String,Object> config){
  long batchSize=Util.toLong(config.getOrDefault("batchSize",10000));
  boolean parallel=Util.toBoolean(config.getOrDefault("parallel",false));
  Map<String,Object> params=(Map)config.getOrDefault("params",Collections.emptyMap());
  log.info("starting batched operation using iteration `%s` in separate thread",cypherIterate);
  try (Result result=db.execute(cypherIterate,params)){
    return iterateAndExecuteBatchedInSeparateThread((int)batchSize,parallel,result,null);
  }
 }

@ Procedure @ PerformsWrites @ Description ( "apoc.periodic.iterate('statement returning items', 'statement per item', {batchSize:1000,parallel:true}) YIELD batches, total - run the second statement for each item returned by the first statement. Returns number of batches and total processed rows" ) public Stream < BatchAndTotalResult > iterate ( @ Name ( "cypherIterate" ) String cypherIterate , @ Name ( "cypherAction" ) String cypherAction , @ Name ( "config" ) Map < String , Object > config ) { long batchSize = Util . toLong ( config . getOrDefault ( "batchSize" , 10000 ) ) ; boolean parallel = Util . toBoolean ( config . getOrDefault ( "parallel" , false ) ) ; Map < String , Object > params = ( Map ) config . getOrDefault ( "params" , Collections . emptyMap ( ) ) ; log . info ( "starting batched operation using iteration `%s` in separate thread" , cypherIterate ) ; try ( Result result = db . execute ( cypherIterate , params ) ) { return iterateAndExecuteBatchedInSeparateThread ( ( int ) batchSize , parallel , result , null ) ; } }
invoke cypheraction in batched transactions being feeded from cypheriteration running in main thread
