17#include <zmq_addon.hpp>
19using json = nlohmann::json;
31 void connect(chrono::milliseconds delay = chrono::milliseconds(0)) {
33 _sender.bind(_dealer_address);
36 void info(ostream &out = cout)
override {
38 out <<
" Dealer Address: " << style::bold << _dealer_address << style::reset << endl;
41 void push(
string message) {
42 _sender.send(zmq::buffer(message), zmq::send_flags::none);
46 const string payload = j.dump();
47 _sender.send(zmq::buffer(payload), zmq::send_flags::none);
51 void load_settings()
override {
53 _dealer_address = cfg[
"dealer_address"].value_or(
"tcp://*:9093");
58 string _dealer_address;
59 zmq::socket_t _sender;
std::string name()
Returns the name of the agent.
void connect(std::chrono::milliseconds delay=std::chrono::milliseconds(250))
Connects the agent to the publish and subscribe endpoints.
virtual void info(std::ostream &out=std::cout)
Prints information about the agent.
void push(string message)
Dealer(string name, string settings_path)
void connect(chrono::milliseconds delay=chrono::milliseconds(0))
void info(ostream &out=cout) override
Prints information about the agent.