AlarmNotifications
PANDA Slow Control Alarm Daemon
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AlarmNotifications::CMSClient Class Reference

C++ Messaging Service client. More...

#include <cmsclient.h>

Inheritance diagram for AlarmNotifications::CMSClient:
Inheritance graph
[legend]
Collaboration diagram for AlarmNotifications::CMSClient:
Collaboration graph
[legend]

Public Member Functions

 CMSClient (AlarmServerConnector &asc)
 Constructor. More...
 
 ~CMSClient ()
 Destructor. More...
 
 CMSClient (const CMSClient &other)=delete
 Copy constructor (deleted) More...
 
 CMSClient (CMSClient &&other)=delete
 Move constructor (deleted) More...
 
CMSClientoperator= (const CMSClient &other)=delete
 Copy assignment (deleted) More...
 
CMSClientoperator= (CMSClient &&other)=delete
 Move assignment (deleted) More...
 

Private Member Functions

virtual void onMessage (const cms::Message *message) noexcept
 Message listener. More...
 
virtual void onException (const cms::CMSException &ex) noexcept
 Exception listener. More...
 

Private Attributes

AlarmServerConnector_asc
 AlarmServerConnector instance. More...
 
cms::Connection * _connection
 CMS connection. More...
 
cms::Session * _session
 CMS session. More...
 
cms::Destination * _topicServer
 CMS topic. More...
 
cms::MessageConsumer * _consumerServer
 CMS receiver. More...
 

Detailed Description

C++ Messaging Service client.

This class encapsulates the C++ API of the Apache ActiveMQ library. Apache ActiceMQ is an implementation of the Java Messaging Service standard used by the CSS (Control System Studio) Alarm Server. The activemq-cpp library's API is therefore called C++ Messaging Service (CMS).

This class connects to the Apache ActiveMQ message broker, subscribes to the topic of the CSS alarm server and receives all the messages there. The messages are then parsed, filtered and the relevant ones forwarded to AlarmServerConnector.

Definition at line 70 of file cmsclient.h.

Constructor & Destructor Documentation

CMSClient::CMSClient ( AlarmServerConnector asc)

Constructor.

Creates the necessary objects and connects to the Apache ActiveMQ message broker.

Parameters
ascReference to the AlarmServerConnector instance that should be notified when a relevant message arrives.
Exceptions
cms::CMSExceptionSomething went wrong within Apache ActiveMQ
std::runtime_errorInitialization error

Definition at line 52 of file cmsclient.cpp.

CMSClient::~CMSClient ( )

Destructor.

Closes the connection to the message broker and cleans everything up.

Definition at line 115 of file cmsclient.cpp.

AlarmNotifications::CMSClient::CMSClient ( const CMSClient other)
delete

Copy constructor (deleted)

This class cannot be copied.

Parameters
otherAnother instance of CMSClient
AlarmNotifications::CMSClient::CMSClient ( CMSClient &&  other)
delete

Move constructor (deleted)

This class cannot be moved.

Parameters
otherAnother instance of CMSClient

Member Function Documentation

void CMSClient::onException ( const cms::CMSException &  ex)
privatevirtualnoexcept

Exception listener.

This method will be called by the ActiveMQ library if an exception occurs in the messaging system

Parameters
exThe CMS exception
Returns
Nothing

Definition at line 187 of file cmsclient.cpp.

void CMSClient::onMessage ( const cms::Message *  message)
privatevirtualnoexcept

Message listener.

This method will be called by the ActiveMQ library if a message is received from the message broker.

Parameters
messageCMS message object
Returns
Nothing

Definition at line 163 of file cmsclient.cpp.

CMSClient& AlarmNotifications::CMSClient::operator= ( const CMSClient other)
delete

Copy assignment (deleted)

This class cannot be copied.

Parameters
otherAnother instance of CMSClient
Returns
Nothing (deleted)
CMSClient& AlarmNotifications::CMSClient::operator= ( CMSClient &&  other)
delete

Move assignment (deleted)

This class cannot be moved.

Parameters
otherAnother instance of CMSClient
Returns
Nothing (deleted)

Member Data Documentation

AlarmServerConnector& AlarmNotifications::CMSClient::_asc
private

AlarmServerConnector instance.

Set by the constructor.

Definition at line 78 of file cmsclient.h.

cms::Connection* AlarmNotifications::CMSClient::_connection
private

CMS connection.

Connection to the C++ Messaging Service

Definition at line 84 of file cmsclient.h.

cms::MessageConsumer* AlarmNotifications::CMSClient::_consumerServer
private

CMS receiver.

Class to receive and parse the messages received from the ActiveMQ message broker

Definition at line 102 of file cmsclient.h.

cms::Session* AlarmNotifications::CMSClient::_session
private

CMS session.

Session on the C++ Messaging Service

Definition at line 90 of file cmsclient.h.

cms::Destination* AlarmNotifications::CMSClient::_topicServer
private

CMS topic.

Topic on the message broker, i.e. "name" of the "chatroom" where the CSS Alarm Server publishes its messages.

Definition at line 96 of file cmsclient.h.


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