Events limits for batching

Hi Temporal team,

I am looking at batching and aggregation, and referring to money batch as an example:
samples-java/AccountTransferWorkflowImpl.java at main · temporalio/samples-java (github.com)

Understand that the workflow has a hard limit of 50000 history events, and we have a batch containing around a million of transactions need to be aggregated. And each signal will have 4 events logged into event history, then we will end up having millions of events. How should we implement this batch and aggregation logics to overcome this hard limit 50000?

Or instead of using temporal, we need to build our own batching and aggregation components and querying from database?

Best regards,
Jx

Please check the batch samples: samples-java/src/main/java/io/temporal/samples/batch at main · temporalio/samples-java · GitHub