Dripline-Cpp  v2.4.2
Dripline Implementation in C++
heartbeater.hh
Go to the documentation of this file.
1 /*
2  * heatbeater.hh
3  *
4  * Created on: Apr 26, 2019
5  * Author: N.S. Oblath
6  */
7 
8 #ifndef DRIPLINE_HEARTBEATER_HH_
9 #define DRIPLINE_HEARTBEATER_HH_
10 
11 #include "dripline_api.hh"
12 #include "dripline_fwd.hh"
13 #include "uuid.hh"
14 
15 #include "cancelable.hh"
16 #include "member_variables.hh"
17 
18 #include <thread>
19 
20 namespace dripline
21 {
22 
52  class DRIPLINE_API heartbeater : public virtual scarab::cancelable
53  {
54  public:
56  heartbeater( service_ptr_t a_service = service_ptr_t() );
57  heartbeater( const heartbeater& ) = delete;
58  heartbeater( heartbeater&& a_orig );
59  virtual ~heartbeater();
60 
61  heartbeater& operator=( const heartbeater& ) = delete;
62  heartbeater& operator=( heartbeater&& a_orig );
63 
71  void execute( const std::string& a_name, uuid_t a_id, const std::string& a_routing_key );
72 
74  mv_accessible( unsigned, heartbeat_interval_s );
76  mv_accessible( unsigned, check_timeout_ms );
77 
78  mv_referrable( service_ptr_t, service );
79 
80  mv_atomic( bool, stop );
81 
82  protected:
83  std::thread f_heartbeat_thread;
84 
85  };
86 
87 } /* namespace dripline */
88 
89 #endif /* DRIPLINE_HEARTBEATER_HH_ */
std::thread f_heartbeat_thread
Definition: heartbeater.hh:83
Consumer of Dripline messages on a particular queue.
Definition: service.hh:72
#define DRIPLINE_API
Definition: dripline_api.hh:34
boost::uuids::uuid uuid_t
Universally-unique-identifier type containing 16 hexadecimal characters.
Definition: uuid.hh:26
A heartbeater repeatedly sends an alert on a particular time interval.
Definition: heartbeater.hh:52
std::shared_ptr< service > service_ptr_t
Definition: dripline_fwd.hh:42