EII Message Bus C Reference
Public Member Functions | Protected Member Functions | List of all members
eii::msgbus::SubscriberThread< T > Class Template Reference

#include <msgbus.hpp>

Inheritance diagram for eii::msgbus::SubscriberThread< T >:
eii::msgbus::BaseMsgbusThread

Public Member Functions

 SubscriberThread (config_t *msgbus_config, std::condition_variable &err_cv, std::string topic, MessageQueue *output_queue, std::string service_name, std::chrono::milliseconds timeout=std::chrono::milliseconds(250))
 
 ~SubscriberThread ()
 
- Public Member Functions inherited from eii::msgbus::BaseMsgbusThread
 BaseMsgbusThread (config_t *msgbus_config, std::condition_variable &err_cv)
 
virtual ~BaseMsgbusThread ()
 
virtual void start ()
 
virtual void join ()
 
virtual void stop ()
 

Protected Member Functions

void run () override
 

Additional Inherited Members

- Protected Attributes inherited from eii::msgbus::BaseMsgbusThread
MsgbusContextm_ctx
 
std::atomic< bool > m_stop
 
std::condition_variable & m_err_cv
 

Detailed Description

template<class T>
class eii::msgbus::SubscriberThread< T >

Helper object for subscribing in a thread to messages from the message bus and placing them in a message queue.

Constructor & Destructor Documentation

◆ SubscriberThread()

template<class T >
eii::msgbus::SubscriberThread< T >::SubscriberThread ( config_t *  msgbus_config,
std::condition_variable &  err_cv,
std::string  topic,
MessageQueue output_queue,
std::string  service_name,
std::chrono::milliseconds  timeout = std::chrono::milliseconds(250) 
)
inline

Constructor.

Note
This object is not responsible for freeing the MessageQueue, it will free the message bus configuration if no exception is thrown.
Exceptions
MsgbusExceptionThrown if an error occurs in the message bus.
Parameters
msgbus_config- Message bus context configuration
err_cv- Condition variable to use to notify the main application if an error has occurred
topic- Topic to subscribe on
output_queue- Output queue for received messages
timeout- Timeout in milliseconds to use in between checking if the thread should stop

◆ ~SubscriberThread()

template<class T >
eii::msgbus::SubscriberThread< T >::~SubscriberThread ( )
inline

Destructor.

Member Function Documentation

◆ run()

template<class T >
void eii::msgbus::SubscriberThread< T >::run ( )
inlineoverrideprotectedvirtual

Subscriber thread run method.

Implements eii::msgbus::BaseMsgbusThread.


The documentation for this class was generated from the following file: