async function processEvents(client, rows, batchMode = false) {
    let statuses = [];
    if (!batchMode) {
        const workers = rows.map(async row => await processEventWithWorker(row));
        statuses = await Promise.all(workers);
    } else {
        const events = rows.map(row => new Event(row));
        const pipelineId = events[0].pipelineId;
        statuses = await processEventBatch(pipelineId, events);
    }

    statuses.forEach((eventStatus) => {
        if (!eventStatus) {
            logger.error('eventStatus is invalid. Pipeline may stop processing');
        }
        const { id, success, consoleLogs } = eventStatus;
        client.query('UPDATE outbound_queue SET state= $1, console_log=$2 WHERE id = $3', [success ? 'COMPLETED' : 'FAILED', consoleLogs || '', id]);
    });
}
Events are processed in adhoc mode via a worker pool, or on the same thread in batch mode
@param {*} client 
@param {*} rows 
@param {*} batchMode