-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventPersistenceService.cs
36 lines (32 loc) · 1.21 KB
/
EventPersistenceService.cs
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
using System;
using bagend_ml.Client;
using bagend_ml.Client.Model;
namespace bagend_ml
{
public class EventPersistenceService
{
private readonly EventApiRESTClient _eventApiRESTClient;
private readonly Executor _executor;
private readonly ILogger<EventPersistenceService> _logger;
public EventPersistenceService(EventApiRESTClient eventApiRESTClient,
Executor executor,
ILogger<EventPersistenceService> logger)
{
_eventApiRESTClient = eventApiRESTClient;
_executor = executor;
_logger = logger;
}
public void PostRecordedEvent(ExternallyRecordedEvent externallyRecordedEvent)
{
var genericEvent = externallyRecordedEvent.GetGenericEvent();
_logger.LogInformation("submitting externally-recorded-event {} posting to threadpool {}",
genericEvent.EventName,
_executor.GetName());
_executor.execute(new ActionRunnable(() =>
{
_eventApiRESTClient.SubmitEvent(genericEvent);
_logger.LogInformation("externally-recorded-event {} posting thread exiting", genericEvent.EventName);
}));
}
}
}