Aggregate data and run batch job?

I want to collect data in an aggregation and execute it as a batch in an interval. How can I achieve this in Hangfire?

For instance, say that I add emails in an aggregation:


Now I want a Hangfire job to pickup all the mails and execute a single job for it:

// Function that runs daily or when there are more than 100 mails
Task SendMails(List<string> mails) {

How can I achieve this in Hangfire?

Without knowing how the aggregation works, I would assume it occurs outside of any Hangfire implementation. That looks like a basic queuing of a job passing the list of email addresses. You can review the documentation on how to queue a job. You should know that the job info is serialized. If there are a lot of email addresses being passed, this could be a performance hit.