I have one more question
try
{
var batchResult = await context.CallActivityAsync<BatchResultZara>("FetchZaraProductsBatch", new BatchRequest
{
Limit = limit,
Offset = input.Offset,
Query = input.Section,
Section = input.Section,
CorrelationId = context.InstanceId
}, options: options);
isLastPage = batchResult.IsLastPage;
input.Offset = batchResult.LastPickedPosition;
totalClothes = await context.CallActivityAsync<int>("AccumulateTotalClothes", new AccumulateRequest
{
PreviousTotal = totalClothes,
BatchTotal = batchResult.ItemsSearched
});
if (!isLastPage)
{
context.ContinueAsNew(input); // This is the important bit.
}
}
catch (Exception ex)
{
logger.LogError($"Failed to fetch batch after retries. Error: {ex.Message}");
throw;
}
// After all batches are processed, log via an activity function to ensure it's called once
await context.CallActivityAsync("LogFinalProcessingResults", new ProcessingResultInput
{
Section = input.Section,
TotalClothes = totalClothes
});
I want to accumulate all imported results and log only once at the end of durable but right now it seems that it is logged every time, how to achive that? @Andrew B