|
| service (const scarab::param_node &a_config=scarab::param_node(), const std::string &a_queue_name="", const std::string &a_broker_address="", unsigned a_port=0, const std::string &a_auth_file="", const bool a_make_connection=true) |
|
| service (const bool a_make_connection, const scarab::param_node &a_config=scarab::param_node()) |
|
| service (const service &)=delete |
|
| service (service &&a_orig) |
|
virtual | ~service () |
|
service & | operator= (const service &)=delete |
|
service & | operator= (service &&a_orig) |
|
| snake_case_mv_accessible (status, status) |
|
| snake_case_mv_accessible (bool, enable_scheduling) |
|
bool | add_child (endpoint_ptr_t a_endpoint_ptr) |
| Add a synchronous child endpoint. More...
|
|
bool | add_async_child (endpoint_ptr_t a_endpoint_ptr) |
| Add an asynchronous child endpoint. More...
|
|
virtual sent_msg_pkg_ptr | send (request_ptr_t a_request) const |
| Sends a request message and returns a channel on which to listen for a reply. More...
|
|
virtual sent_msg_pkg_ptr | send (reply_ptr_t a_reply) const |
| Sends a reply message. More...
|
|
virtual sent_msg_pkg_ptr | send (alert_ptr_t a_alert) const |
| Sends an alert message. More...
|
|
bool | start () |
|
bool | listen () |
|
bool | stop () |
|
virtual bool | listen_on_queue () |
| Waits for AMQP messages arriving on the channel. More...
|
|
virtual void | submit_message (message_ptr_t a_message) |
| Submit a message for direct processing. More...
|
|
virtual void | send_reply (reply_ptr_t a_reply) const |
| Sends a reply message. More...
|
|
| snake_case_mv_accessible (uuid_t, id) |
|
| snake_case_mv_referrable (sync_map_t, sync_children) |
|
| snake_case_mv_referrable (async_map_t, async_children) |
|
| snake_case_mv_referrable (std::string, broadcast_key) |
|
| core (const scarab::param_node &a_config=scarab::param_node(), const std::string &a_broker_address="", unsigned a_port=0, const std::string &a_auth_file="", const bool a_make_connection=true) |
|
| core (const bool a_make_connection, const scarab::param_node &a_config=scarab::param_node()) |
|
| core (const core &a_orig) |
|
| core (core &&a_orig) |
|
virtual | ~core () |
|
core & | operator= (const core &a_orig) |
|
core & | operator= (core &&a_orig) |
|
| snake_case_mv_referrable (std::string, address) |
|
| snake_case_mv_accessible (unsigned, port) |
|
| snake_case_mv_referrable (std::string, username) |
|
| snake_case_mv_referrable (std::string, password) |
|
| snake_case_mv_referrable (std::string, requests_exchange) |
|
| snake_case_mv_referrable (std::string, alerts_exchange) |
|
| snake_case_mv_referrable (std::string, heartbeat_routing_key) |
|
| snake_case_mv_accessible (unsigned, max_payload_size) |
|
| snake_case_mv_accessible (bool, make_connection) |
|
| endpoint (const std::string &a_name) |
|
| endpoint (const endpoint &a_orig) |
|
| endpoint (endpoint &&a_orig) |
|
virtual | ~endpoint () |
|
endpoint & | operator= (const endpoint &a_orig) |
|
endpoint & | operator= (endpoint &&a_orig) |
|
| snake_case_mv_referrable (std::string, name) |
|
| snake_case_mv_referrable (service_ptr_t, service) |
|
reply_ptr_t | submit_request_message (const request_ptr_t a_request) |
| Directly submit a request message to this endpoint. More...
|
|
void | submit_reply_message (const reply_ptr_t a_reply) |
| Directly submit a reply message to this endpoint. More...
|
|
void | submit_alert_message (const alert_ptr_t a_alert) |
| Directly submit an alert message to this endpoint. More...
|
|
virtual void | on_reply_message (const reply_ptr_t a_reply) |
|
virtual void | on_alert_message (const alert_ptr_t a_alert) |
|
virtual reply_ptr_t | do_run_request (const request_ptr_t a_request) |
|
virtual reply_ptr_t | do_get_request (const request_ptr_t a_request) |
|
virtual reply_ptr_t | do_set_request (const request_ptr_t a_request) |
|
virtual reply_ptr_t | do_cmd_request (const request_ptr_t a_request) |
|
void | sort_message (const message_ptr_t a_request) |
|
uuid_t | enable_lockout (const scarab::param_node &a_tag) |
| enable lockout with randomly-generated key More...
|
|
uuid_t | enable_lockout (const scarab::param_node &a_tag, uuid_t a_key) |
| enable lockout with user-supplied key More...
|
|
bool | disable_lockout (const uuid_t &a_key, bool a_force=false) |
|
bool | is_locked () const |
|
bool | check_key (const uuid_t &a_key) const |
|
| listener_receiver () |
|
| listener_receiver (const listener_receiver &)=delete |
|
| listener_receiver (listener_receiver &&a_orig) |
|
listener_receiver & | operator= (const listener_receiver &)=delete |
|
listener_receiver & | operator= (listener_receiver &&a_orig) |
|
| listener () |
|
| listener (const listener &)=delete |
|
| listener (listener &&a_orig) |
|
virtual | ~listener () |
|
listener & | operator= (const listener &)=delete |
|
listener & | operator= (listener &&a_orig) |
|
| snake_case_mv_referrable (amqp_channel_ptr, channel) |
|
| snake_case_mv_referrable (std::string, consumer_tag) |
|
| snake_case_mv_accessible (unsigned, listen_timeout_ms) |
|
| snake_case_mv_referrable (std::thread, listener_thread) |
|
| concurrent_receiver () |
|
| concurrent_receiver (const concurrent_receiver &)=delete |
|
| concurrent_receiver (concurrent_receiver &&a_orig) |
|
virtual | ~concurrent_receiver () |
|
concurrent_receiver & | operator= (const concurrent_receiver &)=delete |
|
concurrent_receiver & | operator= (concurrent_receiver &&a_orig) |
|
virtual void | process_message (message_ptr_t a_message) |
| Deposits the message in the concurrent queue (called by the listener) More...
|
|
void | execute () |
| Handles messages that appear in the concurrent queue by calling submit_message() . More...
|
|
| receiver () |
|
| receiver (const receiver &a_orig)=delete |
|
| receiver (receiver &&a_orig) |
|
virtual | ~receiver () |
|
receiver & | operator= (const receiver &a_orig)=delete |
|
receiver & | operator= (receiver &&a_orig) |
|
void | handle_message_chunk (amqp_envelope_ptr a_envelope) |
|
void | wait_for_message (incoming_message_pack &a_pack, const std::string &a_message_id) |
|
void | process_message_pack (incoming_message_pack &a_pack, const std::string &a_message_id) |
| Converts a message pack into a Dripline message, and then submits the message for processing. More...
|
|
| snake_case_mv_referrable (incoming_message_map, incoming_messages) |
| Stores the incomplete messages. More...
|
|
| snake_case_mv_accessible (unsigned, single_message_wait_ms) |
| Wait time for message chunks from a single message. More...
|
|
reply_ptr_t | wait_for_reply (const sent_msg_pkg_ptr a_receive_reply, int a_timeout_ms=0) |
|
reply_ptr_t | wait_for_reply (const sent_msg_pkg_ptr a_receive_reply, bool &a_chan_valid, int a_timeout_ms=0) |
|
| heartbeater (service_ptr_t a_service=service_ptr_t()) |
| Primary constructor. A service pointer is required to be able to send messages. More...
|
|
| heartbeater (const heartbeater &)=delete |
|
| heartbeater (heartbeater &&a_orig) |
|
virtual | ~heartbeater () |
|
heartbeater & | operator= (const heartbeater &)=delete |
|
heartbeater & | operator= (heartbeater &&a_orig) |
|
void | execute (const std::string &a_name, uuid_t a_id, const std::string &a_routing_key) |
|
| snake_case_mv_accessible (unsigned, heartbeat_interval_s) |
| Interval between heartbeat alerts (default: 60 s) More...
|
|
| snake_case_mv_accessible (unsigned, check_timeout_ms) |
| Timing interval for the internal loop (default: 1000 ms) More...
|
|
| snake_case_mv_referrable (service_ptr_t, service) |
|
| snake_case_mv_atomic (bool, stop) |
|
| scheduler () |
|
| scheduler (const scheduler &)=delete |
|
| scheduler (scheduler &&) |
|
virtual | ~scheduler () |
|
scheduler & | operator= (const scheduler &)=delete |
|
scheduler & | operator= (scheduler &&) |
|
int | schedule (executable_t an_executable, time_point_t an_exe_time) |
|
int | schedule (executable_t an_executable, duration_t an_interval, time_point_t an_exe_time=std::chrono::system_clock ::now()) |
|
void | unschedule (int an_id) |
| Unschedule an event using the event's ID. More...
|
|
void | execute () |
| Main execution loop for the scheduler. More...
|
|
| snake_case_mv_accessible (duration_t, exe_buffer) |
| The time difference from "now" that determines whether an event is executed. More...
|
|
| snake_case_mv_accessible (duration_t, cycle_time) |
| Main thread cycle time. More...
|
|
| snake_case_mv_referrable_const (simple_executor, the_executor) |
| The executor used to execute events. More...
|
|
| snake_case_mv_referrable_const (events_map_t, events) |
| The scheduled events, stored in a map sorted by execution time. More...
|
|
Consumer of Dripline messages on a particular queue.
- Author
- N.S. Oblath
The service class is the implementation of the "service" concept in Dripline. It's the primary component that makes up a Dripline mesh.
The lifetime of a service is defined by the three main functions:
start()
– create the AMQP channel, create the AMQP queue, bind the routing keys, and start consuming AMQP messages
listen()
– starts the heartbeat and scheduler threads (optional), starts the receiver thread, and waits for and handles messages on the queue
stop()
– (called asynchronously) cancels the listening service
The ability to handle and respond to Dripline messages is embodied in the endpoint
class. Service uses endoint
in three ways:
- Service is an endpoint. A service can be setup to handle messages directed to it.
- Service has basic child endpoints. These are also called "synchronous" endpoints. These endpoints use the same AMQP queue as the service itself. Messages send to the service and to the synchronous endpoints are all handled serially.
- Service has asynchronous child endpoints. These endpoints each have their own AMQP queue and thread responsible for receiving and handling their messages.
A service has a number of key characteristics (most of which come from its parent classes): core
– Has all of the basic AMQP capabilities, sending messages, and making and manipulating connections endpoint
– Handles Dripline messages listener_receiver
– Asynchronously recieves AMQP messages and turns them into Dripline messages heartbeater
– Sends periodic heartbeat messages scheduler
– Can schedule events
As is apparent from the above descriptions, a service is responsible for a number of threads when it executes: Listening – grabs AMQP messages off the channel when they arrive Message-wait – any incomplete multi-part Dripline message will setup a thread to wait until the message is complete, and then submits it for handling Receiver – grabs completed Dripline messages and handles it Async endpoint listening – same as abovefor each asynchronous endpoint Async endpoint message-wait – same as above for each asynchronous endpoint Async endpoint receiver – same as above for each asynchronous endpoint Heatbeater – sends regular heartbeat messages Scheduler – executes scheduled events
Definition at line 72 of file service.hh.