ReCodEx - Task Broker
ReCodEx is complex programmer testing solution, primary targeted to technical universities. It's highly customizable and based on modern technologies.
reactor_status_notifier Class Reference

#include <reactor_status_notifier.h>

+ Inheritance diagram for reactor_status_notifier:

Public Member Functions

 reactor_status_notifier (handler_interface::response_cb callback, const std::string &key)
 
virtual void error (const std::string &desc)
 
virtual void rejected_job (const std::string &job_id, const std::string &desc="")
 
virtual void rejected_jobs (std::vector< std::string > job_ids, const std::string &desc="")
 
virtual void job_done (const std::string &job_id)
 
virtual void job_failed (const std::string &job_id, const std::string &desc="")
 

Detailed Description

A status notifier that forwards status messages to a handler registered in our ZeroMQ reactor. This enables us to send the messages asynchronously - the broker doesn't have to wait for HTTP requests

Definition at line 14 of file reactor_status_notifier.h.

Constructor & Destructor Documentation

§ reactor_status_notifier()

reactor_status_notifier::reactor_status_notifier ( handler_interface::response_cb  callback,
const std::string &  key 
)
Parameters
callbackA callback that sends messages through a reactor. It is expected this class will be used in reactor event handlers, hence the callback type.
keyReactor event key for messages sent by the notifier

Definition at line 4 of file reactor_status_notifier.cpp.

Member Function Documentation

§ error()

void reactor_status_notifier::error ( const std::string &  desc)
virtual

Basically tells frontend that there was some serious problem which has to be solved by administrator. Should be used only for generic errors which does not need any special treatment.

Parameters
descdescription of error which was caused in broker
Note
Implementation has to be exceptionless.

Implements status_notifier_interface.

Definition at line 9 of file reactor_status_notifier.cpp.

§ job_done()

void reactor_status_notifier::job_done ( const std::string &  job_id)
virtual

Notify that job with given id was successfully executed.

Parameters
job_ididentification of job
Note
Implementation has to be exceptionless.

Implements status_notifier_interface.

Definition at line 28 of file reactor_status_notifier.cpp.

§ job_failed()

void reactor_status_notifier::job_failed ( const std::string &  job_id,
const std::string &  desc = "" 
)
virtual

Is called when worker return job results with status not equal to OK.

Parameters
job_ididentification of failed job
descdescription which come with results from worker
Note
Implementation has to be exceptionless.

Implements status_notifier_interface.

Definition at line 34 of file reactor_status_notifier.cpp.

§ rejected_job()

void reactor_status_notifier::rejected_job ( const std::string &  job_id,
const std::string &  desc = "" 
)
virtual

Nofity frontend that broker cannot assign one particular job.

Parameters
job_ididentification of job
descdescription why job was rejected
Note
Implementation has to be exceptionless.

Implements status_notifier_interface.

Definition at line 14 of file reactor_status_notifier.cpp.

§ rejected_jobs()

void reactor_status_notifier::rejected_jobs ( std::vector< std::string >  job_ids,
const std::string &  desc = "" 
)
virtual

Notify frontend that broker had to throw away some jobs and they have to be execute again. This might happen for instance if worker dies and there is none with the same headers.

Parameters
job_idslist of job ids which was not executed
descdescription why jobs were rejected
Note
Implementation has to be exceptionless.

Implements status_notifier_interface.

Definition at line 21 of file reactor_status_notifier.cpp.


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