forked from microsoft/kernel-memory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyHandler.cs
More file actions
38 lines (30 loc) · 1.11 KB
/
MyHandler.cs
File metadata and controls
38 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.SemanticMemory.Diagnostics;
using Microsoft.SemanticMemory.Pipeline;
public class MyHandler : IPipelineStepHandler
{
private readonly IPipelineOrchestrator _orchestrator;
private readonly ILogger<MyHandler> _log;
public MyHandler(
string stepName,
IPipelineOrchestrator orchestrator,
ILogger<MyHandler>? log = null)
{
this.StepName = stepName;
this._orchestrator = orchestrator;
this._log = log ?? DefaultLogger<MyHandler>.Instance;
}
/// <inheritdoc />
public string StepName { get; }
/// <inheritdoc />
public async Task<(bool success, DataPipeline updatedPipeline)> InvokeAsync(DataPipeline pipeline, CancellationToken cancellationToken = default)
{
/* ... your custom ...
* ... handler ...
* ... business logic ... */
Console.WriteLine("My handler is working");
// Remove this - here only to avoid build errors
await Task.Delay(0, cancellationToken).ConfigureAwait(false);
return (true, pipeline);
}
}