MICO Platform
 All Classes Namespaces Functions Variables Friends
Public Member Functions | List of all members
mico::event::EventManager Class Reference
Inheritance diagram for mico::event::EventManager:

Public Member Functions

 EventManager (const std::string &host)
 
 EventManager (const std::string &host, const std::string &user, const std::string &password)
 
 EventManager (const std::string &host, int rabbitPort, int marmottaPort, const std::string &user, const std::string &password)
 Initialise the event manager, setting up any necessary channels and connections.
 
virtual ~EventManager ()
 Shut down the event manager, cleaning up and closing any registered channels, services and connections.
 
mico::persistence::PersistenceServicegetPersistenceService ()
 Return a reference to the persistence service used by this event manager, e.g. More...
 
void onData (AMQP::Connection *connection, const char *data, size_t size)
 Method that is called by the AMQP library every time it has data available that should be sent to RabbitMQ. More...
 
void onError (AMQP::Connection *connection, const char *message)
 When the connection ends up in an error state this method is called. More...
 
void onConnected (AMQP::Connection *connection)
 Method that is called when the login attempt succeeded. More...
 
void onClosed (AMQP::Connection *connection)
 Method that is called when the connection was closed. More...
 
void registerService (AnalysisService *service)
 Register the given service with the event manager. More...
 
void unregisterService (AnalysisService *service)
 Unregister the service with the given ID. More...
 
void injectContentItem (const mico::persistence::ContentItem &item)
 Trigger analysis of the given content item. More...
 

Member Function Documentation

mico::persistence::PersistenceService * mico::event::EventManager::getPersistenceService ( )

Return a reference to the persistence service used by this event manager, e.g.

Get the persistence service.

for creating or managing content items.

On the first call it creates the instance using the marmotta and storage base URI provided by the configuration service.

void mico::event::EventManager::injectContentItem ( const mico::persistence::ContentItem item)

Trigger analysis of the given content item.

Parameters
itemcontent item to analyse
Exceptions
IOException
void mico::event::EventManager::onClosed ( AMQP::Connection *  connection)

Method that is called when the connection was closed.

This is the counter part of a call to Connection::close() and it confirms that the connection was correctly closed.

Parameters
connectionThe connection that was closed and that is now unusable
void mico::event::EventManager::onConnected ( AMQP::Connection *  connection)

Method that is called when the login attempt succeeded.

After this method is called, the connection is ready to use. This is the first method that is normally called after you've constructed the connection object.

According to the AMQP protocol, you must wait for the connection to become ready (and this onConnected method to be called) before you can start using the Connection object. However, this AMQP library will cache all methods that you call before the connection is ready, so in reality there is no real reason to wait for this method to be called before you send the first instructions.

Parameters
connectionThe connection that can now be used
void mico::event::EventManager::onData ( AMQP::Connection *  connection,
const char *  data,
size_t  size 
)

Method that is called by the AMQP library every time it has data available that should be sent to RabbitMQ.

Parameters
connectionpointer to the main connection object
datamemory buffer with the data that should be sent to RabbitMQ
sizesize of the buffer
void mico::event::EventManager::onError ( AMQP::Connection *  connection,
const char *  message 
)

When the connection ends up in an error state this method is called.

This happens when data comes in that does not match the AMQP protocol

After this method is called, the connection no longer is in a valid state and can no longer be used.

This method has an empty default implementation, although you are very much advised to implement it. When an error occurs, the connection is no longer usable, so you probably want to know.

Parameters
connectionThe connection that entered the error state
messageError message
void mico::event::EventManager::registerService ( AnalysisService service)

Register the given service with the event manager.

Parameters
service
void mico::event::EventManager::unregisterService ( AnalysisService service)

Unregister the service with the given ID.

Parameters
service
Exceptions
IOException

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