-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCommandChainFirstElementProcessor.cs
More file actions
44 lines (39 loc) · 1.62 KB
/
CommandChainFirstElementProcessor.cs
File metadata and controls
44 lines (39 loc) · 1.62 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
39
40
41
42
43
44
using Botticelli.Client.Analytics;
using Botticelli.Framework.Commands.Validators;
using Botticelli.Shared.ValueObjects;
using FluentValidation;
using Microsoft.Extensions.Logging;
namespace Botticelli.Framework.Commands.Processors;
public class CommandChainFirstElementProcessor<TInputCommand> : CommandChainProcessor<TInputCommand>,
ICommandChainFirstElementProcessor
where TInputCommand : class, ICommand
{
public CommandChainFirstElementProcessor(ILogger<CommandChainProcessor<TInputCommand>> logger,
ICommandValidator<TInputCommand> commandValidator,
MetricsProcessor metricsProcessor,
IValidator<Message> messageValidator)
: base(logger,
commandValidator,
metricsProcessor,
messageValidator)
{
}
public override async Task ProcessAsync(Message message, CancellationToken token)
{
Logger.LogDebug(Next == null
? $"{nameof(CommandChainProcessor<TInputCommand>)} : no next step, returning"
: $"{nameof(CommandChainProcessor<TInputCommand>)} : next step is '{Next?.GetType().Name}'");
if (_bot != null)
{
if (Next != null)
{
Next.SetBot(_bot);
await Next.ProcessAsync(message, token)!;
}
}
}
protected override Task InnerProcess(Message message, CancellationToken token)
{
return Task.CompletedTask;
}
}