This implementation aggregates incoming data into a Redis list from potentially concurrent workflow executions. It buffers the data for a set period before a single execution retrieves and processes the entire batch.
Trigger: Data is received from a trigger (e.g., an external workflow execution).
Lock Check: The system verifies that the queue is not currently locked; if it is, the process waits.
Append: The received data is appended to a Redis list.
Tagging: A unique execution identifier is generated and written to a specific Redis key (acting as a "last writer" marker).
Wait: The execution pauses for a configured duration.
Verification: After the wait, the execution checks if the Redis key still contains its specific identifier.
Exit Condition: If the identifier has changed, it indicates a newer execution has arrived. The current execution terminates.
Processing: If the identifier matches, this execution assumes responsibility for the batch. It locks the queue, retrieves all data, clears the Redis list, releases the lock, and forwards the aggregated data further.