APOC.PERIODIC.ITERATE Dynamic list iteration java/Spring

  1. I want to pass the list that needs to be iterated and create nodes and relationships out of it.
  2. I am using Apoc.periodic.iterate now because previously i have tried with unwind which caused deadlock due to parallel execution.
  3. Help me to fix the current code section.
  4. I am processing more than 900k data in chunks. Which i will read it from kafka topics.

@Query("CALL apoc.periodic.iterate("+"""
+ " UNWIND $items as item return item" ,"
+ ""MERGE (src:Item {name: item.name}) "
+ " ON CREATE SET src.name = item.name, "
+ " src.updateDate = {processDate} "
+ "MERGE (dest:ItemDet {upc: item.upc}) "
+ " ON CREATE SET dest.upc = item.upc, "
+ " dest.creationDate = {processDate} " )",
{batchSize:1000, parallel:false,iterateList:true,params:{items:{items}}})")
Result mergeItems(@Param("items") List<?> items,
@Param("processDate") String processDate);

You missed to pass in processDate as a parameter to the periodic.iterate.