-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSupportTicketFlow.cs
More file actions
23 lines (19 loc) · 890 Bytes
/
Copy pathSupportTicketFlow.cs
File metadata and controls
23 lines (19 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
namespace Cleipnir.Flows.Sample.Presentation.G_SupportTicket;
public class SupportTicketFlow : Flow<SupportTicketRequest>
{
public override async Task Run(SupportTicketRequest request)
{
var (supportTicketId, customerSupportAgents) = request;
for (var i = 0;; i++)
{
var customerSupportAgent = customerSupportAgents[i % customerSupportAgents.Length];
await Effect.Capture(
$"RequestSupportForTicket{i}",
() => RequestSupportForTicket(supportTicketId, customerSupportAgent, iteration: i)
);
//wait for ticket taken, ticket rejected or timeout
}
}
private Task RequestSupportForTicket(Guid supportTicketId, string customerSupportAgent, int iteration)
=> MessageBroker.Send(new TakeSupportTicket(supportTicketId, customerSupportAgent, iteration));
}