Once the simulation finishes, Spark Structured Streaming reads payment.processed from the beginning, processes what is available exactly once (AvailableNow) and prints the per-product summary.
Solid arrows: calls or published messages. Dashed: replies or returns. Green: success. Red: rejections and errors. Dashed amber boxes: alternative branches; dashed blue boxes: optional steps or loops.
What to notice
Spark runs in its own container and only starts after simulacion has finished, so it reads events that are already published.
startingOffsets = earliest makes it read the topic from the start; that is why start.sh wipes the volumes before every run, so old payments are not counted.
The from_json schema must match the PagoProcesado and LineaPagada records; a misnamed field arrives as null with no error.
Trigger.AvailableNow() processes whatever is in the topic and stops, instead of listening forever like a regular stream.
The checkpoint lives in /tmp/analitica-checkpoint inside the container and disappears with --rm.