Dripline-Cpp  v2.4.2
Dripline Implementation in C++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
core Class Reference

Basic AMQP interactions, including sending messages and interacting with AMQP channels. More...

#include <core.hh>

Inheritance diagram for core:
Inheritance graph

Public Member Functions

 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 ()
 
coreoperator= (const core &a_orig)
 
coreoperator= (core &&a_orig)
 
virtual sent_msg_pkg_ptr send (request_ptr_t a_request) const
 
virtual sent_msg_pkg_ptr send (reply_ptr_t a_reply) const
 
virtual sent_msg_pkg_ptr send (alert_ptr_t a_alert) const
 
 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)
 

Static Public Member Functions

static bool listen_for_message (amqp_envelope_ptr &a_envelope, amqp_channel_ptr a_channel, const std::string &a_consumer_tag, int a_timeout_ms=0, bool a_do_ack=true)
 return: if false, channel is no longer useable; if true, may be reused More...
 

Static Public Attributes

static bool s_offline = false
 

Protected Member Functions

sent_msg_pkg_ptr do_send (message_ptr_t a_message, const std::string &a_exchange, bool a_expect_reply) const
 
amqp_channel_ptr send_withreply (message_ptr_t a_message, std::string &a_reply_consumer_tag, const std::string &a_exchange) const
 
bool send_noreply (message_ptr_t a_message, const std::string &a_exchange) const
 
amqp_channel_ptr open_channel () const
 

Static Protected Member Functions

static bool setup_exchange (amqp_channel_ptr a_channel, const std::string &a_exchange)
 
static bool setup_queue (amqp_channel_ptr a_channel, const std::string &a_queue_name)
 
static bool bind_key (amqp_channel_ptr a_channel, const std::string &a_exchange, const std::string &a_queue_name, const std::string &a_routing_key)
 
static std::string start_consuming (amqp_channel_ptr a_channel, const std::string &a_queue_name)
 
static bool stop_consuming (amqp_channel_ptr a_channel, std::string &a_consumer_tag)
 
static bool remove_queue (amqp_channel_ptr a_channel, const std::string &a_queue_name)
 

Friends

class receiver
 

Detailed Description

Basic AMQP interactions, including sending messages and interacting with AMQP channels.

Author
N.S. Oblath

The configuration for a core object is supplied via the constructor. The basic required information can be obtained from dripline_config. The configuration values have default parameters, and they can be modified with the config param_node, and a few parameters can be specified explicitly as constructor arguments. The order of precedence for those values is (items higher in the list override those below them): Constructor arguments (other than a_config) Config param_node object Defaults

If the broker is not specified in either the config object or as a constructor parameter, it will be requested from the authentication file.

A second constructor allows a user to create a core object without connecting to a broker.

The primary user interface is core::send(), one of which exists for each type of message (request, reply, and alert).

Core also contains a number of utility functions that wrap the main interactions with AMQP channels. Classes wishing to take advantage of those functions should inherit from core.

Definition at line 72 of file core.hh.

Constructor & Destructor Documentation

◆ core() [1/4]

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 
)

Parameters specified in a_config will override the default values. Parameters specified as individual parameters will override a_config. If the broker address is not specified, it will be requested from the authentication file.

Definition at line 46 of file core.cc.

◆ core() [2/4]

core ( const bool  a_make_connection,
const scarab::param_node &  a_config = scarab::param_node() 
)

Definition at line 113 of file core.cc.

◆ core() [3/4]

core ( const core a_orig)

Definition at line 120 of file core.cc.

◆ core() [4/4]

core ( core &&  a_orig)

Definition at line 132 of file core.cc.

◆ ~core()

~core ( )
virtual

Definition at line 147 of file core.cc.

Member Function Documentation

◆ bind_key()

bool bind_key ( amqp_channel_ptr  a_channel,
const std::string &  a_exchange,
const std::string &  a_queue_name,
const std::string &  a_routing_key 
)
staticprotected

Definition at line 381 of file core.cc.

◆ do_send()

sent_msg_pkg_ptr do_send ( message_ptr_t  a_message,
const std::string &  a_exchange,
bool  a_expect_reply 
) const
protected

Definition at line 198 of file core.cc.

◆ listen_for_message()

bool listen_for_message ( amqp_envelope_ptr a_envelope,
amqp_channel_ptr  a_channel,
const std::string &  a_consumer_tag,
int  a_timeout_ms = 0,
bool  a_do_ack = true 
)
static

return: if false, channel is no longer useable; if true, may be reused

Definition at line 498 of file core.cc.

◆ open_channel()

amqp_channel_ptr open_channel ( ) const
protected

Definition at line 296 of file core.cc.

◆ operator=() [1/2]

core & operator= ( const core a_orig)

Definition at line 150 of file core.cc.

◆ operator=() [2/2]

core & operator= ( core &&  a_orig)

Definition at line 164 of file core.cc.

◆ remove_queue()

bool remove_queue ( amqp_channel_ptr  a_channel,
const std::string &  a_queue_name 
)
staticprotected

Definition at line 468 of file core.cc.

◆ send() [1/3]

sent_msg_pkg_ptr send ( request_ptr_t  a_request) const
virtual

Sends a request message and returns a channel on which to listen for a reply. Default exchange is "requests"

Reimplemented in service.

Definition at line 180 of file core.cc.

◆ send() [2/3]

sent_msg_pkg_ptr send ( reply_ptr_t  a_reply) const
virtual

Sends a reply message Default exchange is "requests"

Reimplemented in service.

Definition at line 186 of file core.cc.

◆ send() [3/3]

sent_msg_pkg_ptr send ( alert_ptr_t  a_alert) const
virtual

Sends an alert message Default exchange is "alerts"

Reimplemented in service.

Definition at line 192 of file core.cc.

◆ send_noreply()

bool send_noreply ( message_ptr_t  a_message,
const std::string &  a_exchange 
) const
protected

◆ send_withreply()

amqp_channel_ptr send_withreply ( message_ptr_t  a_message,
std::string &  a_reply_consumer_tag,
const std::string &  a_exchange 
) const
protected

◆ setup_exchange()

bool setup_exchange ( amqp_channel_ptr  a_channel,
const std::string &  a_exchange 
)
staticprotected

Definition at line 330 of file core.cc.

◆ setup_queue()

bool setup_queue ( amqp_channel_ptr  a_channel,
const std::string &  a_queue_name 
)
staticprotected

Definition at line 355 of file core.cc.

◆ snake_case_mv_accessible() [1/3]

snake_case_mv_accessible ( unsigned  ,
port   
)

◆ snake_case_mv_accessible() [2/3]

snake_case_mv_accessible ( unsigned  ,
max_payload_size   
)

◆ snake_case_mv_accessible() [3/3]

snake_case_mv_accessible ( bool  ,
make_connection   
)

◆ snake_case_mv_referrable() [1/6]

snake_case_mv_referrable ( std::string  ,
address   
)

◆ snake_case_mv_referrable() [2/6]

snake_case_mv_referrable ( std::string  ,
username   
)

◆ snake_case_mv_referrable() [3/6]

snake_case_mv_referrable ( std::string  ,
password   
)

◆ snake_case_mv_referrable() [4/6]

snake_case_mv_referrable ( std::string  ,
requests_exchange   
)

◆ snake_case_mv_referrable() [5/6]

snake_case_mv_referrable ( std::string  ,
alerts_exchange   
)

◆ snake_case_mv_referrable() [6/6]

snake_case_mv_referrable ( std::string  ,
heartbeat_routing_key   
)

◆ start_consuming()

std::string start_consuming ( amqp_channel_ptr  a_channel,
const std::string &  a_queue_name 
)
staticprotected

Definition at line 407 of file core.cc.

◆ stop_consuming()

bool stop_consuming ( amqp_channel_ptr  a_channel,
std::string &  a_consumer_tag 
)
staticprotected

Definition at line 432 of file core.cc.

Friends And Related Function Documentation

◆ receiver

friend class receiver
friend

Definition at line 119 of file core.hh.

Member Data Documentation

◆ s_offline

bool s_offline = false
static

Definition at line 75 of file core.hh.


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