Agent::Agent() try : num_connect_attempts_ { 4 }, request_schema_ { getRequestMessageSchema() }, connector_ptr_ { new PCPClient::Connector { BROKER_URL, AGENT_CLIENT_TYPE, CA, CERT, KEY } } { } catch (PCPClient::connection_config_error& e) { std::string err_msg { "failed to configure the PCP Connector: " }; throw agent_error { err_msg + e.what() }; }
Agent::Agent() try : num_connect_attempts_ { 4 }, request_schema_ { getRequestMessageSchema() }, connector_ptr_ { new PCPClient::Connector { BROKER_URL, AGENT_CLIENT_TYPE, CA, CERT, KEY } } { // Validator::registerSchema() PCPClient::Schema song_schema { SONG_SCHEMA, PCPClient::ContentType::Json }; song_schema.addConstraint("artist", T_C::String, true); // mandatory song_schema.addConstraint("album", T_C::String, false); // optional song_schema.addConstraint("year", T_C::String, false); // optional validator_.registerSchema(song_schema); } catch (PCPClient::connection_config_error& e) { std::string err_msg { "failed to configure the PCP Connector: " }; throw agent_error { err_msg + e.what() }; }