async function sendEventBatch()

in azure-pipelines-wrapper/eventhub.js [17:30]


async function sendEventBatch(eventDatas, app)
{
    if (producer == null){
        producer = new EventHubProducerClient(eventHubNamespace, eventHubName, credential);
    };
    const batch = await producer.createBatch();
    eventDatas.forEach(eventData => {
        if (!batch.tryAdd(eventData)){
            app.log.error("[ EVENTHUB ] Failed to add eventData");
        }
    });
    let rc = await producer.sendBatch(batch);
    app.log.info(`[ EVENTHUB ] ${rc}`)
}