I have the following code in an Orchestrator:
var parallelTasks = new List<Task>();
// Get Records
List<Record> records = await context.CallActivityAsync<List<Record>>("GetRecords", orchestrationContext);
// Write Records
foreach (Record record in records)
{
parallelTasks.Add(context.CallActivityAsync<int>("WriteRecord", record));
}
await Task.WhenAll(parallelTasks);
This fails, because GetRecords returns too much data (60000 records) and the Orchestrator does not continue as CallActivityAsync cannot return more than 8mb of data.
This may also fail because it will essentially attempt to start 60000 activities for each write.
I am doing it like this so Azure will write to the ADL using several threads. At first I tried with Semaphores and multiple sources online told me that one shouldn't use Sempahores but "CallActivityAsync" instead, which will allow Azure to manage its own threads.
How can I solve this and achieve multi-threaded write to ADL?
For the record, I am using a library that can only write a single file at a time (I know the new library from MS includes a Bulk Write, but I am unable to use that for different reasons).