|
dxFeed Graal CXX API v9.0.0
|
Manages network connections to feed or publisher. More...
#include <DXEndpoint.hpp>
Classes | |
| class | Builder |
| Builder class for DXEndpoint that supports additional configuration properties. More... | |
Public Types | |
| enum class | Role : std::int32_t { FEED , ON_DEMAND_FEED , STREAM_FEED , PUBLISHER , STREAM_PUBLISHER , LOCAL_HUB } |
| Represents the role of an endpoint that was specified during its creation. More... | |
| enum class | State : std::int32_t { NOT_CONNECTED , CONNECTING , CONNECTED , CLOSED } |
| Represents the current state of endpoint. More... | |
| using | Ptr = std::shared_ptr<DXEndpoint> |
| The alias to a type of shared pointer to the DXEndpoint object. | |
| using | Unique = std::unique_ptr<DXEndpoint> |
| The alias to a type of unique pointer to the DXEndpoint object. | |
| Public Types inherited from SharedEntity | |
| using | Ptr = std::shared_ptr<SharedEntity> |
| The alias to a type of shared pointer to the SharedEntity object. | |
Public Member Functions | |
| Role | getRole () const noexcept |
| Returns the role of this endpoint. | |
| State | getState () const |
| Returns the state of this endpoint. | |
| bool | isClosed () const |
| const std::string & | getName () const &noexcept |
| std::size_t | addStateChangeListener (std::function< void(State, State)> listener) noexcept |
| Adds a listener notified about changes in state property. | |
| void | removeStateChangeListener (std::size_t listenerId) noexcept |
| Removes a listener notified about changes in state property. | |
| SimpleHandler< void(DXEndpoint::State, DXEndpoint::State)> & | onStateChange () noexcept |
| Returns the onStateChange handler that can be used to add or remove listeners. | |
| std::optional< ConnectionError > | getLastConnectionError () const |
| Returns the last connection error of this endpoint: the newest failed connect attempt or dropped connection of all its connectors. | |
| std::vector< MessageConnectorInfo > | getConnectors () const |
| Returns the snapshots of the message connectors of this endpoint: one for each address it connects to. | |
| std::size_t | addMessageConnectorListener (std::function< void(const MessageConnectorInfo &)> listener) |
| Adds a listener called after the state of a message connector of this endpoint changes, with a snapshot of that connector taken at the call. | |
| void | removeMessageConnectorListener (std::size_t listenerId) noexcept |
| Removes a listener added with DXEndpoint::addMessageConnectorListener(). | |
| std::shared_ptr< DXEndpoint > | user (StringParam user) |
| Changes username for this endpoint. | |
| std::shared_ptr< DXEndpoint > | password (StringParam password) |
| Changes password for this endpoint. | |
| std::shared_ptr< DXEndpoint > | connect (StringParam address) |
| Connects to the specified remote address. | |
| void | reconnect () const |
| Terminates all established network connections and initiates connecting again with the same address. | |
| void | disconnect () const |
| Terminates all remote network connections. | |
| void | disconnectAndClear () const |
| Terminates all remote network connections and clears stored data. | |
| void | close () const |
| Closes this endpoint. | |
| void | awaitNotConnected () const |
| Waits while this endpoint state becomes NOT_CONNECTED or CLOSED. | |
| void | awaitProcessed () const |
| Waits until this endpoint stops processing data (becomes quiescent). | |
| void | closeAndAwaitTermination () const |
| Closes this endpoint and wait until all pending data processing tasks are completed. | |
| std::shared_ptr< DXFeed > | getFeed () const |
| std::shared_ptr< DXPublisher > | getPublisher () const |
| std::optional< TimePeriod > | getRequestedAggregationPeriod () const |
| Returns the aggregation period that this endpoint requests from the server, or an empty value if no period is requested. | |
| void | setRequestedAggregationPeriod (const TimePeriod &requestedAggregationPeriod) const |
| Sets the aggregation period that this endpoint requests from the server. | |
| void | setRequestedAggregationPeriod (std::chrono::milliseconds requestedAggregationPeriod) const |
| Sets the aggregation period that this endpoint requests from the server. | |
| void | setRequestedAggregationPeriod (std::int64_t requestedAggregationPeriod) const |
| Sets the aggregation period that this endpoint requests from the server. | |
| void | setRequestedAggregationPeriod (std::nullopt_t) const |
| Clears the aggregation period that this endpoint requests from the server: the server falls back to its default period. | |
| TimePeriodInfo | getAggregationPeriodInfo () const |
| Returns the aggregation period that the servers report, over all connections of this endpoint. | |
| std::string | toString () const override |
| Returns a string representation of the current object. | |
| Public Member Functions inherited from SharedEntity | |
| template<typename T> | |
| bool | is () const noexcept |
| Checks that the object is of type T: its dynamic type is T or derived from T. | |
| template<typename T> | |
| std::shared_ptr< T > | sharedAs () noexcept |
| Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr. | |
| template<typename T> | |
| std::shared_ptr< T > | sharedAs () const noexcept |
| Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr. | |
| Public Member Functions inherited from Entity | |
| virtual | ~Entity () noexcept |
| The default virtual d-tor. | |
Static Public Member Functions | |
| static std::shared_ptr< DXEndpoint > | getInstance () |
| Returns a default application-wide singleton instance of DXEndpoint with a FEED role. | |
| static std::shared_ptr< DXEndpoint > | getInstance (Role role) |
| Returns a default application-wide singleton instance of DXEndpoint for a specific role. | |
| static std::shared_ptr< Builder > | newBuilder () |
| Creates a new Builder instance. | |
| static std::shared_ptr< DXEndpoint > | create () |
| Creates an endpoint with FEED role. | |
| static std::shared_ptr< DXEndpoint > | create (Role role) |
| Creates an endpoint with a specified role. | |
| Static Public Member Functions inherited from RequireMakeShared< DXEndpoint > | |
| static auto | createShared (Args &&...args) |
| Creates a smart pointer to an object. | |
Static Public Attributes | |
| static constexpr char | NAME_PROPERTY [] = "name" |
| "name" | |
| static constexpr char | DXFEED_PROPERTIES_PROPERTY [] = "dxfeed.properties" |
| "dxfeed.properties" | |
| static constexpr char | DXFEED_ADDRESS_PROPERTY [] = "dxfeed.address" |
| "dxfeed.address" | |
| static constexpr char | DXFEED_USER_PROPERTY [] = "dxfeed.user" |
| "dxfeed.user" | |
| static constexpr char | DXFEED_PASSWORD_PROPERTY [] = "dxfeed.password" |
| "dxfeed.password" | |
| static constexpr char | DXFEED_THREAD_POOL_SIZE_PROPERTY [] = "dxfeed.threadPoolSize" |
| "dxfeed.threadPoolSize" | |
| static constexpr char | DXFEED_AGGREGATION_PERIOD_PROPERTY [] = "dxfeed.aggregationPeriod" |
| "dxfeed.aggregationPeriod" | |
| static constexpr char | DXFEED_WILDCARD_ENABLE_PROPERTY [] = "dxfeed.wildcard.enable" |
| "dxfeed.wildcard.enable" | |
| static constexpr char | DXFEED_STRIPE_PROPERTY [] = "dxfeed.stripe" |
| "dxfeed.stripe" | |
| static constexpr char | DXFEED_STICKY_SUBSCRIPTION_PROPERTY [] = "dxfeed.stickySubscriptionPeriod" |
| "dxfeed.stickySubscriptionPeriod" | |
| static constexpr char | DXFEED_REQUESTED_AGGREGATION_PERIOD_PROPERTY [] = "dxfeed.requestedAggregationPeriod" |
| "dxfeed.requestedAggregationPeriod" | |
| static constexpr char | DXPUBLISHER_PROPERTIES_PROPERTY [] = "dxpublisher.properties" |
| "dxpublisher.properties" | |
| static constexpr char | DXPUBLISHER_ADDRESS_PROPERTY [] = "dxpublisher.address" |
| "dxpublisher.address" | |
| static constexpr char | DXPUBLISHER_THREAD_POOL_SIZE_PROPERTY [] = "dxpublisher.threadPoolSize" |
| "dxpublisher.threadPoolSize" | |
| static constexpr char | DXENDPOINT_EVENT_TIME_PROPERTY [] = "dxendpoint.eventTime" |
| "dxendpoint.eventTime" | |
| static constexpr char | DXENDPOINT_STORE_EVERYTHING_PROPERTY [] = "dxendpoint.storeEverything" |
| "dxendpoint.storeEverything" | |
| static constexpr char | DXSCHEME_NANO_TIME_PROPERTY [] = "dxscheme.nanoTime" |
| "dxscheme.nanoTime" | |
| static constexpr char | DXSCHEME_ENABLED_PROPERTY_PREFIX [] = "dxscheme.enabled." |
| "dxscheme.enabled." | |
Friends | |
| struct | OnDemandService |
| class | DXFeedSubscription |
Manages network connections to feed or publisher.
There are per-process (per GraalVM Isolate for now) ready-to-use singleton instances that are available with DXEndpoint::getInstance() and DXEndpoint::getInstance(Role) methods as well as factory methods DXEndpoint::create() and DXEndpoint::create(Role), and a number of configuration methods. Advanced properties can be configured using newBuilder()->withProperty(key, value)->build().
See DXFeed for details on how to subscribe to symbols and receive events.
Each endpoint has a role that is specified on its creation and cannot be changed afterward. The default factory method DXEndpoint::create() creates an endpoint with a FEED role. Endpoints with other roles are created with DXEndpoint::create(Role) factory method. Endpoint role is represented by DXEndpoint::Role enumeration.
Endpoint role defines the behavior of its connect method:
FEED connects to the remote data feed provider and is optimized for real-time or delayed data processing (this is a default role). DXEndpoint::getFeed() method returns a feed object that subscribes to this remote data feed provider and receives events from it. When event processing threads cannot keep up (don't have enough CPU time), data is dynamically conflated to minimize latency between received events and their processing time. For example,
This endpoint is automatically connected to the configured data feed, as explained in the default properties section.
Each endpoint has a state that can be retrieved with the DXEndpoint::getState method. When an endpoint is created with any role and the default address is not specified in default properties, then it is not connected to any remote endpoint. Its state is NOT_CONNECTED.
Feed and publisher endpoints can connect to remote endpoints of the opposite role. Connection is initiated by connect method. The endpoint state becomes CONNECTING.
When the actual connection to the remote endpoint is established, the endpoint state becomes CONNECTED.
Network connections can temporarily break and return endpoint back into the CONNECTING state. File connections can be completed and return endpoint into the NOT_CONNECTED state.
Connection to the remote endpoint can be terminated with the DXEndpoint::disconnect() method. The endpoint state becomes NOT_CONNECTED.
Endpoint can be closed with DXEndpoint::close() method. The endpoint state becomes CLOSED. This is a final state. All connections are terminated and all internal resources that are held by this endpoint are freed. No further connections can be initiated.
The EventType::getEventTime() on received events is available only when the endpoint is created with DXEndpoint::DXENDPOINT_EVENT_TIME_PROPERTY property and the data source has embedded event times. This is typically true only for data events that are read from historical tape files (see above) and from OnDemandService. Events that are coming from network connections do not have embedded event time information, and event time is not available for them anyway.
Default properties are loaded from the "dxfeed.properties" or "dxpublisher.properties" file depending on the role of the created endpoint. "dxfeed.properties" is used for FEED and ON_DEMAND_FEED, "dxpublisher.properties" is used for PUBLISHER. STREAM_FEED and LOCAL_HUB do not support the properties file.
The location of this file can be specified using withProperty(::DXFEED_PROPERTIES_PROPERTY, path) or withProperty(::DXPUBLISHER_PROPERTIES_PROPERTY, path) correspondingly. When the location of this file is not explicitly specified using withProperty method, then the file path is taken from a system property with the corresponding name.
Defaults for individual properties can be also provided using system properties when they are not specified in the configuration file.
The DXEndpoint::NAME_PROPERTY is the exception to the above rule. It is never loaded from system properties. It can be only specified in the configuration file or programmatically. There is a convenience Builder.withName method for it. It is recommended to assign short and meaningful endpoint names when multiple endpoints are used in the same process (one GraalVM Isolate for now). The name of the endpoint shall describe its role in the particular application.
Note that individual properties that are programmatically set using withProperty method always take precedence.
FEED and PUBLISHER automatically establish connection on creation when the corresponding DXEndpoint::DXFEED_ADDRESS_PROPERTY or DXEndpoint::DXPUBLISHER_ADDRESS_PROPERTY is specified.
Endpoint properties can define permanent subscription for specific sets of symbols and event types in the data feed, so that DXFeed methods like getLastEventIfSubscribed, getIndexedEventsIfSubscribed and getTimeSeriesIfSubscribed can be used without a need to create a separate DXFeedSubscription object. Please contact dxFeed support for details on the required configuration.
This class is thread-safe and can be used concurrently from multiple threads without external synchronization.
Some methods that are not marked noexcept may throw exceptions:
| InvalidArgumentException | if the entity's handle is invalid. |
| JavaException | if something happened with the dxFeed API backend |
| GraalException | if something happened with the GraalVM |
|
strong |
Represents the role of an endpoint that was specified during its creation.
| Enumerator | |
|---|---|
| FEED | FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed data processing (this is a default role). DXEndpoint::getFeed() method returns the feed object that subscribes to the remote data feed provider and receives events from it. When event processing threads cannot keep up (don't have enough CPU time), data is dynamically conflated to minimize latency between received events and their processing time. This endpoint is automatically connected to the configured data feed, as explained in the default properties section. |
| ON_DEMAND_FEED | ON_DEMAND_FEED endpoint is similar to DXEndpoint::FEED, but it is designed to be used with OnDemandService for historical data replay only. It is configured with default properties, but is not connected automatically to the data provider until OnDemandService::replay() method is invoked. ON_DEMAND_FEED endpoint cannot be connected to an ordinary data feed at all. OnDemandService::stopAndResume() will have a similar effect to OnDemandService::stopAndClear().
|
| STREAM_FEED | STREAM_FEED endpoint is similar to DXEndpoint::FEED and also connects to the remote data feed provider, but is designed for bulk parsing of data from files. DXEndpoint::getFeed() method returns feed object that subscribes to the data from the opened files and receives events from them. Events from the files are not conflated, are not skipped, and are processed as fast as possible. Note that in this role, the DXFeed::getLastEvent method does not work. |
| PUBLISHER | PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publisher on the local host. DXEndpoint::getPublisher() method returns a publisher object that publishes events to all connected feeds. Note that in this role, the DXFeed::getLastEvent method does not work and time-series subscription is not supported. This endpoint is automatically connected to the configured data feed, as explained in the default properties section. |
| STREAM_PUBLISHER | STREAM_PUBLISHER endpoint is similar to DXEndpoint::PUBLISHER and also connects to the remote publisher hub, but is designed for bulk publishing of data. DXEndpoint::getPublisher() method returns a publisher object that publishes events to all connected feeds. Published events are not conflated, are not skipped, and are processed as fast as possible. Note that in this role, the DXFeed::getLastEvent method does not work and time-series subscription is not supported. |
| LOCAL_HUB | LOCAL_HUB endpoint is a local hub without the ability to establish network connections. Events that are published via publisher are delivered to local feed only. |
|
strong |
Represents the current state of endpoint.
| Enumerator | |
|---|---|
| NOT_CONNECTED | Endpoint was created by is not connected to remote endpoints. |
| CONNECTING | The connect method was called to establish connection to remove endpoint, but the connection is not established yet or was lost. |
| CONNECTED | The connection to the remote endpoint is established. |
| CLOSED | Endpoint was closed. |
| std::size_t DXEndpoint::addMessageConnectorListener | ( | std::function< void(const MessageConnectorInfo &)> | listener | ) |
Adds a listener called after the state of a message connector of this endpoint changes, with a snapshot of that connector taken at the call.
The listener is called on one thread of the dxFeed Graal Native SDK for all the endpoints, not on the executor of the endpoint, one call at a time, never inside DXEndpoint::connect(); it should return quickly, since the next call waits for it. The connection error of a change is recorded before the call, so MessageConnectorInfo::lastError and DXEndpoint::getLastConnectionError() already return it. Fast changes of one connector may come as one call, and the first call for a new connector may read DISCONNECTED before a later one reads CONNECTING. The current states are not passed to a listener when it is added: call DXEndpoint::getConnectors() after adding it. An exception of the listener is reported to ErrorManager. Once the endpoint is closed no new call starts and the listeners are removed. DXEndpoint::close() may wait for a call in progress, so the listener must not wait for the thread that closes the endpoint; the call may also end after DXEndpoint::close() returns.
The first call registers a listener of the endpoint in the dxFeed Graal Native SDK, so it can fail.
This is an experimental API, it may change in future versions.
| listener | The listener to add. |
| JavaException | if something happened with the dxFeed API backend. |
| GraalException | if something happened with the GraalVM, or the dxFeed Graal Native SDK library does not match the one the library was built with. |
|
inlinenoexcept |
Adds a listener notified about changes in state property.
Installed listener can be removed by id with DXEndpoint::removeStateChangeListener method or by call ::onStateChange() -= id;
| listener | The listener to add |
| void DXEndpoint::awaitNotConnected | ( | ) | const |
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
It is a signal that any files opened with the connect("file:...") method were finished reading, but not necessarily were completely processed by the corresponding subscription listeners. Use closeAndAwaitTermination() after this method returns to make sure that all processing has completed.
This method is blocking.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| void DXEndpoint::awaitProcessed | ( | ) | const |
Waits until this endpoint stops processing data (becomes quiescent).
This is important when writing data to file via "tape:..." connector to make sure that all published data was written before closing this endpoint.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| void DXEndpoint::close | ( | ) | const |
Closes this endpoint.
All network connections are terminated as with the ::disconnect() method, and no further connections can be established.
The endpoint state immediately becomes CLOSED. All resources associated with this endpoint are released. A created endpoint lives until it is closed: see Lifetime of the entities and AutoClose.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| void DXEndpoint::closeAndAwaitTermination | ( | ) | const |
Closes this endpoint and wait until all pending data processing tasks are completed.
This method performs the same actions as ::close(), but also awaits termination of all outstanding data processing tasks. It is designed to be used with STREAM_FEED role after ::awaitNotConnected() method returns to make sure that the file was completely processed.
This method is blocking.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| std::shared_ptr< DXEndpoint > DXEndpoint::connect | ( | StringParam | address | ) |
Connects to the specified remote address.
Previously established connections are closed if the new address is different from the old one. This method does nothing if the address does not change or if this endpoint is CLOSED. The endpoint state immediately becomes CONNECTING otherwise.
The address string is provided with the market data vendor agreement. Use "demo.dxfeed.com:7300" for a demo quote feed.
The simplest address strings have the following format:
An address that starts with http://, https://, ws:// or wss:// is not an address of an endpoint (for example, the URLs of REST, CometD and IPF services): such an address throws InvalidArgumentException before the SDK is called. A QD configuration URL http(s)://host/path/<name>.config#<name> is passed to the SDK.
For premium services access credentials must be configured before invocation of connect method using user and password methods.
This method does not wait until the connection actually gets established. The actual connection establishment happens asynchronously after the invocation of this method. However, this method waits until notification about state transition from State::NOT_CONNECTED to State::CONNECTING gets processed by all listeners.
| address | The data source address. |
| InvalidArgumentException | if the address is not valid UTF-8, for example DXEndpoint::connect(address): invalid UTF-8 at byte 12: 0xC3 0x28, or if it is an http(s):// or ws(s):// URL; the message names the expected form of the address and does not repeat the address. |
| JavaException | if something happened with the dxFeed API backend or if the address string is malformed. |
| GraalException |
|
static |
Creates an endpoint with FEED role.
The result of this method is the same as create(DXEndpoint::Role::FEED). This is a shortcut to newBuilder()->build()
| InvalidArgumentException | |
| JavaException | |
| GraalException |
|
static |
Creates an endpoint with a specified role.
This is a shortcut to newBuilder()->withRole(role)->build()
| role | the role. |
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| void DXEndpoint::disconnect | ( | ) | const |
Terminates all remote network connections.
This method does nothing if this endpoint is CLOSED. The endpoint state immediately becomes NOT_CONNECTED otherwise.
This method does not release all resources that are associated with this endpoint. Use ::close() method to release all resources.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| void DXEndpoint::disconnectAndClear | ( | ) | const |
Terminates all remote network connections and clears stored data.
This method does nothing if this endpoint is CLOSED. The endpoint state immediately becomes NOT_CONNECTED otherwise.
This method does not release all resources that are associated with this endpoint. Use the close() method to release all resources.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| TimePeriodInfo DXEndpoint::getAggregationPeriodInfo | ( | ) | const |
Returns the aggregation period that the servers report, over all connections of this endpoint.
The servers report the period when a connection is established, so the result is TimePeriodInfo::UNKNOWN until then, and also when no server reports it (for example, without connections or with an older server). The period applied to the events of a subscription is returned by DXFeedSubscription::getAggregationPeriodInfo().
| InvalidArgumentException | |
| JavaException | |
| GraalException |
References TimePeriodInfo::UNKNOWN.
| std::vector< MessageConnectorInfo > DXEndpoint::getConnectors | ( | ) | const |
Returns the snapshots of the message connectors of this endpoint: one for each address it connects to.
The list is empty when the endpoint is not connected, has the LOCAL_HUB role, or is closed. Each call reads the connectors anew; the values of a snapshot are read one by one (see MessageConnectorInfo). See Connection troubleshooting.
This is an experimental API, it may change in future versions.
| JavaException | if something happened with the dxFeed API backend. |
| GraalException | if something happened with the GraalVM, or the dxFeed Graal Native SDK library does not match the one the library was built with. |
| std::shared_ptr< DXFeed > DXEndpoint::getFeed | ( | ) | const |
| InvalidArgumentException | |
| JavaException | |
| GraalException |
|
static |
Returns a default application-wide singleton instance of DXEndpoint with a FEED role.
Most applications use only a single data-source and should rely on this method to get one. This method creates an endpoint on the first use with a default configuration, as explained in the default properties section of DXEndpoint class documentation. You can provide configuration via system properties as explained there.
This is a shortcut to getInstance(DXEndpoint::Role::FEED).
| InvalidArgumentException | |
| JavaException | |
| GraalException |
|
static |
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Most applications use only a single data-source and should rely on this method to get one. This method creates an endpoint with the corresponding role on the first use with a default configuration, as explained in the default properties section of DXEndpoint class documentation. You can provide configuration via system properties as explained there.
The configuration does not have to include an address. You can use connect(address) and DXEndpoint::disconnect() methods on the instance that is returned by this method to programmatically establish and tear-down connection to a user-provided address.
If you need a fully programmatic configuration and/or multiple endpoints of the same role in your application, then create a custom instance of DXEndpoint with DXEndpoint::newBuilder() method, configure it, and use Builder::build() method.
| role | The role of DXEndpoint instance |
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| std::optional< ConnectionError > DXEndpoint::getLastConnectionError | ( | ) | const |
Returns the last connection error of this endpoint: the newest failed connect attempt or dropped connection of all its connectors.
A successful connection clears nothing: the time of the error tells how old it is. The error stays after a connect to another address and after the endpoint is closed.
Read the error in a connector listener: the error is recorded before that listener is called. A state change listener gives no such order (the state of the endpoint is computed on another thread, so the listener may be called before the error of that change is recorded), and failed connect attempts do not change the state of the endpoint at all: it stays CONNECTING between them. There, compare the time or the count of the error with those seen before. See Connection troubleshooting.
This is an experimental API, it may change in future versions.
| JavaException | if something happened with the dxFeed API backend. |
| GraalException | if something happened with the GraalVM, or the dxFeed Graal Native SDK library does not match the one the library was built with. |
|
noexcept |
| std::shared_ptr< DXPublisher > DXEndpoint::getPublisher | ( | ) | const |
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| std::optional< TimePeriod > DXEndpoint::getRequestedAggregationPeriod | ( | ) | const |
Returns the aggregation period that this endpoint requests from the server, or an empty value if no period is requested.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
|
noexcept |
| DXEndpoint::State DXEndpoint::getState | ( | ) | const |
Returns the state of this endpoint.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
| bool DXEndpoint::isClosed | ( | ) | const |
| InvalidArgumentException | |
| JavaException | |
| GraalException |
|
static |
Creates a new Builder instance.
Use Builder::build() to build an instance of DXEndpoint when all configuration properties were set.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
Referenced by dxfc_dxendpoint_new_builder().
|
noexcept |
Returns the onStateChange handler that can be used to add or remove listeners.
| std::shared_ptr< DXEndpoint > DXEndpoint::password | ( | StringParam | password | ) |
Changes password for this endpoint.
This method shall be called before connect with user to configure service access credentials.
| password | The password. |
| InvalidArgumentException | if the password is not valid UTF-8 (the message names the offset, not the bytes). |
| JavaException | |
| GraalException |
| void DXEndpoint::reconnect | ( | ) | const |
Terminates all established network connections and initiates connecting again with the same address.
The effect of the method is alike to invoking ::disconnect() and ::connect(StringParam) with the current address, but internal resources used for connections may be reused by implementation. TCP connections with multiple target addresses will try to switch to an alternative address, configured reconnect timeouts will apply.
Note: The method will not connect an endpoint that was not initially connected with ::connect(StringParam) method or was disconnected with ::disconnect() method.
The method initiates a short-pathway for reconnecting, so whether observers will have a chance to see an intermediate state State::NOT_CONNECTED depends on the implementation.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
|
noexcept |
Removes a listener added with DXEndpoint::addMessageConnectorListener().
Outside a listener of the library, waits for the calls of the listener in progress on the other threads.
This is an experimental API, it may change in future versions.
| listenerId | The listener id. |
|
noexcept |
Removes a listener notified about changes in state property.
It removes the listener previously installed with DXEndpoint::addStateChangeListener method.
| listenerId | The listener id to remove |
| void DXEndpoint::setRequestedAggregationPeriod | ( | const TimePeriod & | requestedAggregationPeriod | ) | const |
Sets the aggregation period that this endpoint requests from the server.
The server applies the period on its side, reducing the network traffic and the load of the server and the client, and may adjust it by its own rules and limits: getAggregationPeriodInfo() returns the period in effect. TimePeriod::ZERO requests real-time delivery (no aggregation). The period can also be requested with the DXEndpoint::DXFEED_REQUESTED_AGGREGATION_PERIOD_PROPERTY property.
| requestedAggregationPeriod | The requested aggregation period. It must not exceed 24 hours. |
| InvalidArgumentException | |
| JavaException | "IllegalArgumentException" if the period exceeds 24 hours. |
| GraalException |
| void DXEndpoint::setRequestedAggregationPeriod | ( | std::chrono::milliseconds | requestedAggregationPeriod | ) | const |
Sets the aggregation period that this endpoint requests from the server.
See setRequestedAggregationPeriod(const TimePeriod &) const.
| requestedAggregationPeriod | The requested aggregation period. It must not be negative or exceed 24 hours. |
| InvalidArgumentException | |
| JavaException | "IllegalArgumentException" if the period is negative or exceeds 24 hours. |
| GraalException |
| void DXEndpoint::setRequestedAggregationPeriod | ( | std::int64_t | requestedAggregationPeriod | ) | const |
Sets the aggregation period that this endpoint requests from the server.
See setRequestedAggregationPeriod(const TimePeriod &) const.
| requestedAggregationPeriod | The requested aggregation period in milliseconds. It must not be negative or exceed 24 hours (86400000). |
| InvalidArgumentException | |
| JavaException | "IllegalArgumentException" if the period is negative or exceeds 24 hours. |
| GraalException |
| void DXEndpoint::setRequestedAggregationPeriod | ( | std::nullopt_t | ) | const |
Clears the aggregation period that this endpoint requests from the server: the server falls back to its default period.
The same as setRequestedAggregationPeriod(null) in Java.
| InvalidArgumentException | |
| JavaException | |
| GraalException |
|
overridevirtual |
Returns a string representation of the current object.
Reimplemented from SharedEntity.
| std::shared_ptr< DXEndpoint > DXEndpoint::user | ( | StringParam | user | ) |
Changes username for this endpoint.
This method shall be called before connect with password to configure service access credentials.
| user | The username. |
| InvalidArgumentException | if the username is not valid UTF-8 (the message names the offset, not the bytes). |
| JavaException | |
| GraalException |
|
staticconstexpr |
"dxendpoint.eventTime"
Set this property to true to enable event time support. By default, the endpoint does not support event time.
The event time is available only when the corresponding DXEndpoint is created with this property and the data source has embedded event times. This is typically true only for data events that are read from historical tape files and from OnDemandService. Events that are coming from network connections do not have embedded event time information, and event time is not available for them anyway.
Use this property if you need to work with historical data coming from files or from OnDemandService or writing data with times to file via DXPublisher using a "tape:..." address.
|
staticconstexpr |
"dxendpoint.storeEverything"
Set this property to store all lasting and indexed events even when there is no subscription on them. By default, the endpoint stores only events from subscriptions. It works in the same way both for DXFeed and DXPublisher.
Use this property with extreme care, since API does not currently provide any means to remove those events from the storage, and there might be an effective memory leak if the spaces of symbols on which events are published grow without a bound.
|
staticconstexpr |
"dxfeed.address"
Defines default connection address for an endpoint with the role FEED or ON_DEMAND_FEED. Connection is established to this address by the role FEED as soon as the endpoint is created, while the role ON_DEMAND_FEED waits until OnDemandService::(std::int64_t, double) is invoked before connecting.
By default, without this property, a connection is not established until connect(address) is invoked.
Credentials for access to premium services may be configured with DXEndpoint::DXFEED_USER_PROPERTY and DXEndpoint::DXFEED_PASSWORD_PROPERTY.
|
staticconstexpr |
"dxfeed.aggregationPeriod"
Defines a data aggregation period for an endpoint with the role FEED that limits the rate of data notifications. For example, setting the value of this property to "0.1s" limits notification to once every "100ms" (at most 10 per second).
|
staticconstexpr |
"dxfeed.password"
Defines default password for an endpoint with role FEED or ON_DEMAND_FEED.
|
staticconstexpr |
"dxfeed.properties"
Defines a path to a file with properties for an endpoint with the role FEED or ON_DEMAND_FEED. By default, properties are loaded from a path resource named "dxfeed.properties".
The SDK writes to its log (at the INFO level) the name of the loaded file, DXEndpoint is loading properties from <name>, and the resulting address, <name> DXEndpoint with dxfeed.address=<address>: look for these lines when the endpoint connects to an unexpected address.
|
staticconstexpr |
"dxfeed.requestedAggregationPeriod"
Defines a requested aggregation period to be negotiated with the server. The server applies its own rules and limits to the request and applies the resulting period on the server side to control the data transmission rate (reduces network traffic and server load).
Differs from DXEndpoint::DXFEED_AGGREGATION_PERIOD_PROPERTY, which is local and client-side only: the client throttles locally, but the server sends at its own rate.
Format: a TimePeriod string (e.g., "1s", "0.5s", "0" for real-time). If not specified, the server uses its default.
|
staticconstexpr |
"dxfeed.stickySubscriptionPeriod"
Defines a sticky subscription period in the format of TimePeriod.
|
staticconstexpr |
"dxfeed.stripe"
Defines a symbol striping strategy for an endpoint.
|
staticconstexpr |
"dxfeed.threadPoolSize"
Defines thread pool size for an endpoint with the role FEED. By default, the thread pool size is equal to the number of available processors.
|
staticconstexpr |
"dxfeed.user"
Defines default username for an endpoint with the role FEED or ON_DEMAND_FEED.
|
staticconstexpr |
"dxfeed.wildcard.enable"
Set this property to true to turn on wildcard support. By default, the endpoint does not support wildcards. This property is needed for WildcardSymbol support and for the use of "tape:..." address in DXPublisher.
|
staticconstexpr |
"dxpublisher.address"
Defines default connection address for an endpoint with the role PUBLISHER. Connection is established to this address as soon as an endpoint is created. By default, the connection is not established until DXEndpoint::connect(StringParam) is invoked.
|
staticconstexpr |
"dxpublisher.properties"
Defines a path to a file with properties for an endpoint with the role PUBLISHER. By default, properties are loaded from a classpath resource named "dxpublisher.properties".
|
staticconstexpr |
"dxpublisher.threadPoolSize"
Defines thread pool size for an endpoint with the role PUBLISHER. By default, the thread pool size is equal to the number of available processors.
|
staticconstexpr |
"dxscheme.enabled."
Defines whether a specified field from the scheme should be enabled instead of its default behavior. Use it according to the following format: dxscheme.enabled.<field_property_name>=<event_name_mask_glob>
For example, dxscheme.enabled.TimeNanoPart=Trade enables NanoTimePart internal field only in Trade events.
There is a shortcut for turning on nano-time support using DXEndpoint::DXSCHEME_NANO_TIME_PROPERTY.
|
staticconstexpr |
"dxscheme.nanoTime"
Set this property to true to turn on nanoseconds precision business time. By default, this feature is turned off. Business time in most events is available with millisecond precision by default, while Quote events business time is available with seconds precision.
This method provides a higher-level control than turning on individual properties that are responsible for nano-time via DXEndpoint::DXSCHEME_ENABLED_PROPERTY_PREFIX. The later can be used to override of fine-time nano-time support for individual fields. Setting this property to true is essentially equivalent to setting:
|
staticconstexpr |
"name"
Defines property for endpoint name that is used to distinguish multiple endpoints in the same process in logs and in other diagnostic means. Use Builder::withProperty(StringParam, StringParam) method. This property is also changed by the Builder::withName(StringParam) method.