-
Notifications
You must be signed in to change notification settings - Fork 0
/
SystemProcessor.hh
48 lines (37 loc) · 1.12 KB
/
SystemProcessor.hh
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
45
46
47
48
#pragma once
#include "Coordinator.hh"
#include "DatabaseEntityMapper.hh"
#include "IMessageQueue.hh"
#include "Services.hh"
#include "SynchronizedMessageQueue.hh"
#include "Uuid.hh"
#include <atomic>
#include <core_utils/CoreObject.hh>
#include <memory>
#include <thread>
#include <unordered_map>
namespace bsgo {
class SystemProcessor : public utils::CoreObject
{
public:
SystemProcessor(const Uuid systemDbId);
~SystemProcessor() override;
auto getSystemDbId() const -> Uuid;
void pushMessage(IMessagePtr message);
void connectToQueues(IMessageQueue *const internalMessageQueue,
IMessageQueue *const outputMessageQueue);
void start();
void stop();
private:
Uuid m_systemDbId{};
IMessageQueuePtr m_inputMessagesQueue{};
DatabaseEntityMapper m_entityMapper{};
CoordinatorShPtr m_coordinator{};
Services m_services{};
std::atomic_bool m_running{false};
std::thread m_processingThread{};
void asyncSystemProcessing();
};
using SystemProcessorShPtr = std::shared_ptr<SystemProcessor>;
using SystemProcessorMap = std::unordered_map<Uuid, SystemProcessorShPtr>;
} // namespace bsgo