57 const std::vector<addresses::URI>& uris,
58 std::function<
void(
const Status&, std::shared_ptr<IConnection>)>
77 const Status& status, std::shared_ptr<IConnection> connection) {
78 if (status.
code() == StatusCode::SUCCESS) {
85 "Failed to connect to all the URIs."),
86 std::move(connection));
102 (*this)(e.
status(),
nullptr);
110 const std::vector<addresses::URI>*
uris_;
135 const std::vector<addresses::URI>& uris,
136 std::function<
void(
const Status&, std::shared_ptr<IConnection>)>
Definition of BackendList class.
Class of exceptions in cpp-msgpack-rpc library.
const Status & status() const noexcept
Get the status.
StatusCode code() const noexcept
Get the status code.
Class of lists of backends of protocols.
Class to establish a connection using multiple backends of protocols.
std::shared_ptr< IConnector > connector_
Current connector.
void start()
Start to connect to an endpoint.
void async_connect()
Asynchronously connect to an endpoint.
std::function< void(Status, std::shared_ptr< IConnection >)> on_connection_
Callback function called when a connection is established or error occurred in all URIs.
const std::vector< addresses::URI > * uris_
URIs.
void operator()(const Status &status, std::shared_ptr< IConnection > connection)
Handle the result to connect to an endpoint.
std::vector< addresses::URI >::const_iterator current_uri_
Current URI.
MultiBackendConnector(const BackendList &backends, const std::vector< addresses::URI > &uris, std::function< void(const Status &, std::shared_ptr< IConnection >)> on_connection)
Constructor.
const BackendList * backends_
Backends.
Definition of IBackend class.
Definition of IConnection class.
Definition of IConnector class.
Definition of MsgpackRPCException class.
Namespace of internal implementations.
Namespace of transport of messages.
void async_connect(const BackendList &backends, const std::vector< addresses::URI > &uris, std::function< void(const Status &, std::shared_ptr< IConnection >)> on_connection)
Asynchronously connect to an endpoint.
Definition of Status class.
Definition of StatusCode enumeration.