dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
MessageConnectorInfo Struct Reference

A snapshot of a message connector of an endpoint: a connection to an address (DXEndpoint::getConnectors(), DXEndpoint::addMessageConnectorListener()). More...

#include <MessageConnectorInfo.hpp>

Classes

struct  Statistics
 The statistics of a connector since it was created. More...
struct  IoStatistics
 The I/O statistics of a connector since it was created: the cumulative counters of QD's statistics, with the lags and the round-trip times of the records. More...

Public Types

enum class  Kind : std::int32_t { CLIENT_SOCKET = 0 , SERVER_SOCKET = 1 , OTHER = 2 }
 The kind of a connector. A kind that this version of the library does not know reads as OTHER. More...
enum class  State : std::int32_t { CONNECTING = 0 , CONNECTED = 1 , DISCONNECTED = 2 }
 The state of a connector. More...

Public Member Functions

std::string toString () const
 Returns a string representation of the connector in one line: the name, the kind, the state, the address, the current addresses, the counts of the connections and the last error.

Static Public Member Functions

static const char * kindToString (Kind kind) noexcept
 Returns the name of a kind, for example CLIENT_SOCKET.
static const char * stateToString (State state) noexcept
 Returns the name of a state, for example CONNECTED.

Public Attributes

std::string name {}
 The name of the connector, as in the log of QD, for example ClientSocket-Distributor.
Kind kind {Kind::OTHER}
 The kind of the connector.
std::string address {}
 The address the connector was configured with, for example 127.0.0.1:7300, credentials masked.
std::vector< std::string > currentAddresses {}
 The host:port addresses a client socket connector is connected to now, one per connection (a striped connector has several).
State state {State::DISCONNECTED}
 The state of the connector.
bool active {}
 true if the connector is started (it connects or reconnects), false if it is stopped.
std::int32_t connectionCount {}
 The number of the open connections: those of a client socket connector (more than one for a striped connector) or those that a server socket connector accepted.
std::int64_t closedConnectionCount {}
 The number of the connections closed since the connector was created: it grows on each reconnect.
Statistics statistics {}
 The statistics of the connector.
std::optional< IoStatistics > ioStatistics {}
 The I/O statistics of the connector, or std::nullopt when the Graal Native SDK library does not support them.
std::optional< ConnectionError > lastError {}
 The last connection error of the connector, or std::nullopt when it has had none.

Detailed Description

A snapshot of a message connector of an endpoint: a connection to an address (DXEndpoint::getConnectors(), DXEndpoint::addMessageConnectorListener()).

The values are read one by one when the snapshot is taken, so they are not a consistent set: a connection that is established or closed meanwhile may be counted in one value and not in another. The snapshot does not change afterwards; take a new one to see the changes. See Connection troubleshooting.

This is an experimental API, it may change in future versions.

Member Enumeration Documentation

◆ Kind

enum class MessageConnectorInfo::Kind : std::int32_t
strong

The kind of a connector. A kind that this version of the library does not know reads as OTHER.

Enumerator
CLIENT_SOCKET 0 

A client socket connector (an address host:port).

SERVER_SOCKET 1 

A server socket connector (an address :port).

OTHER 2 

Any other connector (a file, a non-blocking or a custom connector), or a kind that this version of the library does not know.

◆ State

enum class MessageConnectorInfo::State : std::int32_t
strong

The state of a connector.

A state that this version of the library does not know reads as DISCONNECTED.

Enumerator
CONNECTING 0 

Started, not connected yet, or reconnecting after a failure or a drop.

CONNECTED 1 

At least one of its connections is established (a server socket connector: it accepts connections).

DISCONNECTED 2 

Stopped, for example replaced by a connect to another address, or its endpoint disconnected or closed.

Member Function Documentation

◆ kindToString()

DXFCPP_BEGIN_NAMESPACE const char * MessageConnectorInfo::kindToString ( Kind kind)
staticnoexcept

Returns the name of a kind, for example CLIENT_SOCKET.

Parameters
kindThe kind.
Returns
The name of the kind.

◆ stateToString()

const char * MessageConnectorInfo::stateToString ( State state)
staticnoexcept

Returns the name of a state, for example CONNECTED.

Parameters
stateThe state.
Returns
The name of the state.

◆ toString()

std::string MessageConnectorInfo::toString ( ) const

Returns a string representation of the connector in one line: the name, the kind, the state, the address, the current addresses, the counts of the connections and the last error.

Returns
The string representation of the connector.

Member Data Documentation

◆ address

std::string MessageConnectorInfo::address {}

The address the connector was configured with, for example 127.0.0.1:7300, credentials masked.

A server socket connector of the address :7400 has *:7400.

◆ currentAddresses

std::vector<std::string> MessageConnectorInfo::currentAddresses {}

The host:port addresses a client socket connector is connected to now, one per connection (a striped connector has several).

Empty when the connector is not connected, and always empty for the other kinds.

◆ name

std::string MessageConnectorInfo::name {}

The name of the connector, as in the log of QD, for example ClientSocket-Distributor.

The connectors of different endpoints may have the same name.