drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
DbListener.h
Go to the documentation of this file.
1
14
15#pragma once
16
17#include <drogon/exports.h>
18#include <functional>
19#include <string>
20#include <memory>
21
22namespace trantor
23{
24class EventLoop;
25}
26
27namespace drogon
28{
29namespace orm
30{
31class DbListener;
32using DbListenerPtr = std::shared_ptr<DbListener>;
33
35class DROGON_EXPORT DbListener
36{
37 public:
38 using MessageCallback = std::function<void(std::string, std::string)>;
39
40 virtual ~DbListener();
41
43
50 static DbListenerPtr newPgListener(const std::string &connInfo,
51 trantor::EventLoop *loop = nullptr);
52
54
69 virtual void listen(const std::string &channel,
70 MessageCallback messageCallback) noexcept = 0;
71
73
76 virtual void unlisten(const std::string &channel) noexcept = 0;
77};
78
79} // namespace orm
80} // namespace drogon
Database asynchronous notification listener abstract class.
Definition DbListener.h:36
virtual void unlisten(const std::string &channel) noexcept=0
Stop listening to channel.
static DbListenerPtr newPgListener(const std::string &connInfo, trantor::EventLoop *loop=nullptr)
Create a new postgresql notification listener.
virtual void listen(const std::string &channel, MessageCallback messageCallback) noexcept=0
Listen to a channel.
Drogon Test is a minimal effort test framework developed because the major C++ test frameworks doesn'...
Definition Attribute.h:23