dxFeed Graal CXX API
Loading...
Searching...
No Matches
api.h File Reference

dxFeed Native C API enums, structs and functions declarations More...

#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  dxfc_dxendpoint_property_t
 The simple key-value structure that represents an endpoint's property. More...
 

Typedefs

typedef enum dxfc_error_code_t dxfc_error_code_t
 List of error codes.
 
typedef enum dxfc_dxendpoint_role_t dxfc_dxendpoint_role_t
 Represents the role of endpoint that was specified during its creation.
 
typedef enum dxfc_dxendpoint_state_t dxfc_dxendpoint_state_t
 Represents the current state of endpoint.
 
typedef void(* dxfc_dxendpoint_state_change_listener) (dxfc_dxendpoint_state_t old_state, dxfc_dxendpoint_state_t new_state, void *user_data)
 The endpoint current state change listener.
 
typedef struct dxfc_dxendpoint_property_t dxfc_dxendpoint_property_t
 The simple key-value structure that represents an endpoint's property.
 
typedef void * dxfc_dxendpoint_t
 The dxFeed endpoint handle.
 
typedef void * dxfc_dxendpoint_builder_t
 The dxFeed endpoint's builder handle.
 
typedef void * dxfc_dxfeed_t
 The dxFeed handle.
 
typedef void * dxfc_dxpublisher_t
 The dxFeed publisher handle.
 

Enumerations

enum  dxfc_error_code_t { DXFC_EC_SUCCESS = 0 , DXFC_EC_G_ERR , DXFC_EC_ERROR = 10000 }
 List of error codes. More...
 
enum  dxfc_dxendpoint_role_t {
  DXFC_DXENDPOINT_ROLE_FEED = 0 , DXFC_DXENDPOINT_ROLE_ON_DEMAND_FEED = 1 , DXFC_DXENDPOINT_ROLE_STREAM_FEED = 2 , DXFC_DXENDPOINT_ROLE_PUBLISHER = 3 ,
  DXFC_DXENDPOINT_ROLE_STREAM_PUBLISHER = 4 , DXFC_DXENDPOINT_ROLE_LOCAL_HUB = 5
}
 Represents the role of endpoint that was specified during its creation. More...
 
enum  dxfc_dxendpoint_state_t { DXFC_DXENDPOINT_STATE_NOT_CONNECTED = 0 , DXFC_DXENDPOINT_STATE_CONNECTING = 1 , DXFC_DXENDPOINT_STATE_CONNECTED = 2 , DXFC_DXENDPOINT_STATE_CLOSED = 3 }
 Represents the current state of endpoint. More...
 

Functions

dxfc_error_code_t dxfc_system_set_property (const char *key, const char *value)
 Sets the system property indicated by the specified key.
 
dxfc_error_code_t dxfc_system_get_property (const char *key, DXFC_OUT char *buffer, size_t buffer_size)
 Gets the system property indicated by the specified key.
 
dxfc_error_code_t dxfc_dxendpoint_new_builder (DXFC_OUT dxfc_dxendpoint_builder_t *builder)
 Creates new dxFeed endpoint's builder instance.
 
dxfc_error_code_t dxfc_dxendpoint_builder_with_role (dxfc_dxendpoint_builder_t builder, dxfc_dxendpoint_role_t role)
 Sets role for the created dxFeed endpoint.
 
dxfc_error_code_t dxfc_dxendpoint_builder_with_name (dxfc_dxendpoint_builder_t builder, const char *name)
 Changes name that is used to distinguish multiple endpoints in the same process (GraalVM Isolate) in logs and in other diagnostic means.
 
dxfc_error_code_t dxfc_dxendpoint_builder_with_property (dxfc_dxendpoint_builder_t builder, const char *key, const char *value)
 Sets the specified property.
 
dxfc_error_code_t dxfc_dxendpoint_builder_with_properties (dxfc_dxendpoint_builder_t builder, const dxfc_dxendpoint_property_t **properties, size_t size)
 Sets all supported properties from the provided properties object.
 
dxfc_error_code_t dxfc_dxendpoint_builder_supports_property (dxfc_dxendpoint_builder_t builder, const char *key, DXFC_OUT int *supports)
 Checks if a property is supported.
 
dxfc_error_code_t dxfc_dxendpoint_builder_build (dxfc_dxendpoint_builder_t builder, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
 Builds the new dxFeed endpoint instance.
 
dxfc_error_code_t dxfc_dxendpoint_builder_free (dxfc_dxendpoint_builder_t builder)
 Removes a builder from the registry.
 
dxfc_error_code_t dxfc_dxendpoint_get_instance (void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
 Returns a default application-wide singleton instance of dxFeed endpoint with a FEED role.
 
dxfc_error_code_t dxfc_dxendpoint_get_instance2 (dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
 Returns a default application-wide singleton instance of DXEndpoint for a specific role.
 
dxfc_error_code_t dxfc_dxendpoint_create (void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
 Creates an endpoint with FEED role.
 
dxfc_error_code_t dxfc_dxendpoint_create2 (dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
 Creates an endpoint with a specified role.
 
dxfc_error_code_t dxfc_dxendpoint_close (dxfc_dxendpoint_t endpoint)
 Closes this endpoint.
 
dxfc_error_code_t dxfc_dxendpoint_close_and_await_termination (dxfc_dxendpoint_t endpoint)
 Closes this endpoint and wait until all pending data processing tasks are completed.
 
dxfc_error_code_t dxfc_dxendpoint_get_role (dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_role_t *role)
 Returns the role of this endpoint.
 
dxfc_error_code_t dxfc_dxendpoint_user (dxfc_dxendpoint_t endpoint, const char *user)
 Changes user name for this endpoint.
 
dxfc_error_code_t dxfc_dxendpoint_password (dxfc_dxendpoint_t endpoint, const char *password)
 Changes password for this endpoint.
 
dxfc_error_code_t dxfc_dxendpoint_connect (dxfc_dxendpoint_t endpoint, const char *address)
 Connects to the specified remote address.
 
dxfc_error_code_t dxfc_dxendpoint_reconnect (dxfc_dxendpoint_t endpoint)
 Terminates all established network connections and initiates connecting again with the same address.
 
dxfc_error_code_t dxfc_dxendpoint_disconnect (dxfc_dxendpoint_t endpoint)
 Terminates all remote network connections.
 
dxfc_error_code_t dxfc_dxendpoint_disconnect_and_clear (dxfc_dxendpoint_t endpoint)
 Terminates all remote network connections and clears stored data.
 
dxfc_error_code_t dxfc_dxendpoint_await_processed (dxfc_dxendpoint_t endpoint)
 Waits until this endpoint stops processing data (becomes quiescent).
 
dxfc_error_code_t dxfc_dxendpoint_await_not_connected (dxfc_dxendpoint_t endpoint)
 Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
 
dxfc_error_code_t dxfc_dxendpoint_get_state (dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_state_t *state)
 Returns the state of this endpoint.
 
dxfc_error_code_t dxfc_dxendpoint_add_state_change_listener (dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
 Adds listener that is notified about changes in state property.
 
dxfc_error_code_t dxfc_dxendpoint_remove_state_change_listener (dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
 Removes listener that is notified about changes in state property.
 
dxfc_error_code_t dxfc_dxendpoint_get_feed (dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed)
 
dxfc_error_code_t dxfc_dxendpoint_get_publisher (dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher)
 
dxfc_error_code_t dxfc_dxendpoint_free (dxfc_dxendpoint_t endpoint)
 Removes the dxFeed endpoint from the registry.
 

Detailed Description

dxFeed Native C API enums, structs and functions declarations

Typedef Documentation

◆ dxfc_dxendpoint_builder_t

The dxFeed endpoint's builder handle.

It is used for searching, adding builders to the "registry", deleting builders from the "registry" and calling functions associated with a particular builder.

The "registry" is responsible for neatly closing resources, shutting down work, and freeing up memory on shutdown. This can be forced by calling the dxfc_dxendpoint_builder_free() function.

◆ dxfc_dxendpoint_state_change_listener

typedef void(* dxfc_dxendpoint_state_change_listener) (dxfc_dxendpoint_state_t old_state, dxfc_dxendpoint_state_t new_state, void *user_data)

◆ dxfc_dxendpoint_t

typedef void* dxfc_dxendpoint_t

The dxFeed endpoint handle.

It is used for searching, adding endpoints to the "registry", deleting endpoints from the "registry" and calling functions associated with a particular endpoint.

The "registry" is responsible for neatly closing resources, shutting down work, and freeing up memory on shutdown. This can be forced by calling the dxfc_dxendpoint_free() function.

Enumeration Type Documentation

◆ dxfc_dxendpoint_role_t

Represents the role of endpoint that was specified during its creation.

Enumerator
DXFC_DXENDPOINT_ROLE_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).

dxfc_dxendpoint_get_feed() function returns 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.

DXFC_DXENDPOINT_ROLE_ON_DEMAND_FEED 

ON_DEMAND_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED, but it is designed to be used with dxfc_on_demand_service_t for historical data replay only.

ON_DEMAND_FEED endpoint cannot be connected to an ordinary data feed at all.

DXFC_DXENDPOINT_ROLE_STREAM_FEED 

STREAM_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED and also connects to the remote data feed provider, but is designed for bulk parsing of data from files.

dxfc_dxendpoint_get_feed() function 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, dxfc_dxfeed_get_last_event() function does not work.

DXFC_DXENDPOINT_ROLE_PUBLISHER 

PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publisher on the local host.

dxfc_dxendpoint_get_publisher() function returns a publisher object that publishes events to all connected feeds. Note, that in this role, dxfc_dxfeed_get_last_event() function does not work and time-series subscription is not supported.

This endpoint is automatically connected to the configured data feed.

DXFC_DXENDPOINT_ROLE_STREAM_PUBLISHER 

STREAM_PUBLISHER endpoint is similar to DXFC_DXENDPOINT_ROLE_PUBLISHER and also connects to the remote publisher hub, but is designed for bulk publishing of data.

dxfc_dxendpoint_get_publisher() function 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, dxfc_dxfeed_get_last_event() function does not work and time-series subscription is not supported.

DXFC_DXENDPOINT_ROLE_LOCAL_HUB 

LOCAL_HUB endpoint is a local hub without ability to establish network connections.

Events that are published via publisher are delivered to local feed only.

◆ dxfc_dxendpoint_state_t

Represents the current state of endpoint.

Enumerator
DXFC_DXENDPOINT_STATE_NOT_CONNECTED 

Endpoint was created by is not connected to remote endpoints.

DXFC_DXENDPOINT_STATE_CONNECTING 

The connect function was called to establish connection to remove endpoint, but connection is not actually established yet or was lost.

DXFC_DXENDPOINT_STATE_CONNECTED 

The connection to remote endpoint is established.

DXFC_DXENDPOINT_STATE_CLOSED 

Endpoint was closed.

◆ dxfc_error_code_t

List of error codes.

Enumerator
DXFC_EC_SUCCESS 

OK.

DXFC_EC_G_ERR 

dxFeed Graal Native API error.

DXFC_EC_ERROR 

The error returned if the current operation cannot be completed.

Function Documentation

◆ dxfc_dxendpoint_add_state_change_listener()

dxfc_error_code_t dxfc_dxendpoint_add_state_change_listener ( dxfc_dxendpoint_t endpoint,
dxfc_dxendpoint_state_change_listener listener )

Adds listener that is notified about changes in state property.

Installed listener can be removed by dxfc_dxendpoint_remove_state_change_listener() function.

Parameters
endpointThe dxFeed endpoint
listenerThe listener to add
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_await_not_connected()

dxfc_error_code_t dxfc_dxendpoint_await_not_connected ( dxfc_dxendpoint_t endpoint)

Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.

It is a signal that any files that were opened with dxfc_dxendpoint_connect(endpoint, "file:...") function were finished reading, but not necessary were completely processed by the corresponding subscription listeners. Use dxfc_dxendpoint_and_await_termination() after this function returns to make sure that all processing has completed.

This function is blocking.

Parameters
endpointThe dxFeed endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_await_processed()

dxfc_error_code_t dxfc_dxendpoint_await_processed ( dxfc_dxendpoint_t endpoint)

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.

Parameters
endpointThe dxFeed endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_builder_build()

dxfc_error_code_t dxfc_dxendpoint_builder_build ( dxfc_dxendpoint_builder_t builder,
void * user_data,
DXFC_OUT dxfc_dxendpoint_t * endpoint )

Builds the new dxFeed endpoint instance.

Parameters
builderThe endpoint's builder
user_dataUser data that will be passed to the endpoint's state transition listeners.
[out]endpointThe created endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_builder_free()

dxfc_error_code_t dxfc_dxendpoint_builder_free ( dxfc_dxendpoint_builder_t builder)

Removes a builder from the registry.

Parameters
builderThe endpoint's builder
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_builder_supports_property()

dxfc_error_code_t dxfc_dxendpoint_builder_supports_property ( dxfc_dxendpoint_builder_t builder,
const char * key,
DXFC_OUT int * supports )

Checks if a property is supported.

Parameters
builderThe endpoint's builder
keyThe property's key to be checked for support
[out]supports1 if the corresponding property key is supported.
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_builder_with_name()

dxfc_error_code_t dxfc_dxendpoint_builder_with_name ( dxfc_dxendpoint_builder_t builder,
const char * name )

Changes name that is used to distinguish multiple endpoints in the same process (GraalVM Isolate) in logs and in other diagnostic means.

Parameters
builderThe endpoint's builder
nameThe endpoint's name
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_builder_with_properties()

dxfc_error_code_t dxfc_dxendpoint_builder_with_properties ( dxfc_dxendpoint_builder_t builder,
const dxfc_dxendpoint_property_t ** properties,
size_t size )

Sets all supported properties from the provided properties object.

Parameters
builderThe endpoint's builder
propertiesThe endpoint's properties
sizeThe size of the endpoint's properties
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, DXFC_EC_SUCCESS, dxfc_dxendpoint_property_t::key, and dxfc_dxendpoint_property_t::value.

◆ dxfc_dxendpoint_builder_with_property()

dxfc_error_code_t dxfc_dxendpoint_builder_with_property ( dxfc_dxendpoint_builder_t builder,
const char * key,
const char * value )

Sets the specified property.

Unsupported properties are ignored.

Parameters
builderThe endpoint's builder
keyThe endpoint's property key
valueThe endpoint's property value
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_builder_with_role()

dxfc_error_code_t dxfc_dxendpoint_builder_with_role ( dxfc_dxendpoint_builder_t builder,
dxfc_dxendpoint_role_t role )

Sets role for the created dxFeed endpoint.

Default role is FEED.

Parameters
builderThe endpoint's builder
roleThe endpoint's role
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_close()

dxfc_error_code_t dxfc_dxendpoint_close ( dxfc_dxendpoint_t endpoint)

Closes this endpoint.

All network connection are terminated as with dxfc_dxendpoint_disconnect() function and no further connections can be established.

The endpoint state immediately becomes CLOSED. All resources associated with this endpoint are released.

Parameters
endpointThe dxFeed endpoint to close
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_close_and_await_termination()

dxfc_error_code_t dxfc_dxendpoint_close_and_await_termination ( dxfc_dxendpoint_t endpoint)

Closes this endpoint and wait until all pending data processing tasks are completed.

This function performs the same actions as dxfc_dxendpoint_close(), but also awaits termination of all outstanding data processing tasks. It is designed to be used with STREAM_FEED role after dxfc_dxendpoint_await_not_connected() function returns to make sure that file was completely processed.

This function is blocking.

Parameters
endpointThe dxFeed endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_connect()

dxfc_error_code_t dxfc_dxendpoint_connect ( dxfc_dxendpoint_t endpoint,
const char * address )

Connects to the specified remote address.

Previously established connections are closed if the new address is different from the old one. This function does nothing if 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:

  • host:port to establish a TCP/IP connection.
  • :port to listen for a TCP/IP connection with a plain socket connector (good for up to a few hundred of connections).

For premium services access credentials must be configured before invocation of connect function using user and password functions.

This function does not wait until connection actually gets established. The actual connection establishment happens asynchronously after the invocation of this function. However, this function waits until notification about state transition from DXFC_DXENDPOINT_STATE_NOT_CONNECTED to DXFC_DXENDPOINT_STATE_CONNECTING gets processed by all listeners.

Javadoc.

Parameters
endpointThe dxFeed endpoint
addressThe data source address
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_create()

dxfc_error_code_t dxfc_dxendpoint_create ( void * user_data,
DXFC_OUT dxfc_dxendpoint_t * endpoint )

Creates an endpoint with FEED role.

The result of this function is the same as dxfc_dxendpoint_create2(DXFC_DXENDPOINT_ROLE_FEED, user_data, &endpoint). This is a shortcut to

dxfc_dxendpoint_builder_build(builder, user_data, &endpoint);
void * dxfc_dxendpoint_builder_t
The dxFeed endpoint's builder handle.
Definition api.h:185
void * dxfc_dxendpoint_t
The dxFeed endpoint handle.
Definition api.h:176
dxfc_error_code_t dxfc_dxendpoint_builder_build(dxfc_dxendpoint_builder_t builder, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Builds the new dxFeed endpoint instance.
Definition DXEndpoint.cpp:719
dxfc_error_code_t dxfc_dxendpoint_new_builder(DXFC_OUT dxfc_dxendpoint_builder_t *builder)
Creates new dxFeed endpoint's builder instance.
Definition DXEndpoint.cpp:609
Parameters
user_dataUser data that will be passed to the endpoint's state transition listeners.
[out]endpointThe created endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_create2()

dxfc_error_code_t dxfc_dxendpoint_create2 ( dxfc_dxendpoint_role_t role,
void * user_data,
DXFC_OUT dxfc_dxendpoint_t * endpoint )

Creates an endpoint with a specified role.

This is a shortcut to

dxfc_dxendpoint_builder_build(builder, user_data, &endpoint);
dxfc_error_code_t dxfc_dxendpoint_builder_with_role(dxfc_dxendpoint_builder_t builder, dxfc_dxendpoint_role_t role)
Sets role for the created dxFeed endpoint.
Definition DXEndpoint.cpp:625
Parameters
roleThe role of dxFeed endpoint instance
user_dataUser data that will be passed to the endpoint's state transition listeners.
[out]endpointThe created endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_disconnect()

dxfc_error_code_t dxfc_dxendpoint_disconnect ( dxfc_dxendpoint_t endpoint)

Terminates all remote network connections.

This function does nothing if this endpoint is CLOSED. The endpoint state immediately becomes NOT_CONNECTED otherwise.

This function does not release all resources that are associated with this endpoint. Use dxfc_dxendpoint_disconnect() function to release all resources.

Parameters
endpointThe dxFeed endpoint to disconnect
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_disconnect_and_clear()

dxfc_error_code_t dxfc_dxendpoint_disconnect_and_clear ( dxfc_dxendpoint_t endpoint)

Terminates all remote network connections and clears stored data.

This function does nothing if this endpoint is CLOSED. The endpoint state immediately becomes NOT_CONNECTED otherwise.

This function does not release all resources that are associated with this endpoint. Use dxfc_dxendpoint_close() function to release all resources.

Parameters
endpointThe dxFeed endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_free()

dxfc_error_code_t dxfc_dxendpoint_free ( dxfc_dxendpoint_t endpoint)

Removes the dxFeed endpoint from the registry.

Parameters
endpointThe dxFeed endpoint to remove
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_get_feed()

dxfc_error_code_t dxfc_dxendpoint_get_feed ( dxfc_dxendpoint_t endpoint,
DXFC_OUT dxfc_dxfeed_t * feed )
Parameters
endpointThe dxFeed endpoint
[out]feed
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_get_instance()

dxfc_error_code_t dxfc_dxendpoint_get_instance ( void * user_data,
DXFC_OUT dxfc_dxendpoint_t * endpoint )

Returns a default application-wide singleton instance of dxFeed endpoint with a FEED role.

Most applications use only a single data-source and should rely on this function to get one. This function creates an endpoint on the first use with a default configuration. You can provide configuration via system properties.

This is a shortcut to

dxfc_error_code_t dxfc_dxendpoint_get_instance2(dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:782
@ DXFC_DXENDPOINT_ROLE_FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition api.h:77
Parameters
user_dataUser data that will be passed to the endpoint's state transition listeners.
[out]endpointThe created endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_get_instance2()

dxfc_error_code_t dxfc_dxendpoint_get_instance2 ( dxfc_dxendpoint_role_t role,
void * user_data,
DXFC_OUT dxfc_dxendpoint_t * endpoint )

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 function to get one. This function creates an endpoint with the corresponding role on the first use with a default configuration. You can provide configuration via system properties.

The configuration does not have to include an address. You can use connect(endpoint, address) and dxfc_dxendpoint_disconnect() functions on the instance that is returned by this function 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 dxFeed endpoint with dxfc_dxendpoint_new_builder() function, configure it, and use dxfc_dxendpoint_builder_build() function.

Parameters
roleThe role of dxFeed endpoint instance
user_dataUser data that will be passed to the endpoint's state transition listeners.
[out]endpointThe created endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_get_publisher()

dxfc_error_code_t dxfc_dxendpoint_get_publisher ( dxfc_dxendpoint_t endpoint,
DXFC_OUT dxfc_dxpublisher_t * publisher )
Parameters
endpointThe dxFeed endpoint
[out]publisher
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_get_role()

dxfc_error_code_t dxfc_dxendpoint_get_role ( dxfc_dxendpoint_t endpoint,
DXFC_OUT dxfc_dxendpoint_role_t * role )

Returns the role of this endpoint.

Parameters
endpointThe dxFeed endpoint
[out]roleThe role of this endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_get_state()

dxfc_error_code_t dxfc_dxendpoint_get_state ( dxfc_dxendpoint_t endpoint,
DXFC_OUT dxfc_dxendpoint_state_t * state )

Returns the state of this endpoint.

Parameters
endpointThe dxFeed endpoint
[out]stateThe state of this endpoint
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_new_builder()

dxfc_error_code_t dxfc_dxendpoint_new_builder ( DXFC_OUT dxfc_dxendpoint_builder_t * builder)

Creates new dxFeed endpoint's builder instance.

Use dxfc_dxendpoint_builder_build to build an instance of dxFeed endpoint when all configuration properties were set.

Parameters
[out]builderThe created endpoint's builder.
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_password()

dxfc_error_code_t dxfc_dxendpoint_password ( dxfc_dxendpoint_t endpoint,
const char * password )

Changes password for this endpoint.

This function shall be called before connect together with user to configure service access credentials.

Parameters
endpointThe dxFeed endpoint
passwordThe user password
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_reconnect()

dxfc_error_code_t dxfc_dxendpoint_reconnect ( dxfc_dxendpoint_t endpoint)

Terminates all established network connections and initiates connecting again with the same address.

The effect of the function is alike to invoking dxfc_dxendpoint_disconnect() and dxfc_dxendpoint_connect() with the current address, but internal resources used for connections may be reused by implementation. TCP connections with multiple target addresses will try switch to an alternative address, configured reconnect timeouts will apply.

Note: The function will not connect endpoint that was not initially connected with dxfc_dxendpoint_connect() function or was disconnected with dxfc_dxendpoint_disconnect() function.

The function initiates a short-path way for reconnecting, so whether observers will have a chance to see an intermediate state DXFC_DXENDPOINT_STATE_NOT_CONNECTED depends on the implementation.

Parameters
endpointThe dxFeed endpoint to reconnect
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_remove_state_change_listener()

dxfc_error_code_t dxfc_dxendpoint_remove_state_change_listener ( dxfc_dxendpoint_t endpoint,
dxfc_dxendpoint_state_change_listener listener )

Removes listener that is notified about changes in state property.

It removes the listener that was previously installed with dxfc_dxendpoint_add_state_change_listener() function.

Parameters
endpointThe dxFeed endpoint
listenerThe listener to remove
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_dxendpoint_user()

dxfc_error_code_t dxfc_dxendpoint_user ( dxfc_dxendpoint_t endpoint,
const char * user )

Changes user name for this endpoint.

This function shall be called before connect together with password to configure service access credentials.

Parameters
endpointThe dxFeed endpoint
userThe user name
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, and DXFC_EC_SUCCESS.

◆ dxfc_system_get_property()

dxfc_error_code_t dxfc_system_get_property ( const char * key,
DXFC_OUT char * buffer,
size_t buffer_size )

Gets the system property indicated by the specified key.

The buffer must be allocated in advance. If the system property value does not fit into the buffer, it will be truncated. The buffer should be large enough to the \0 at the end. Invalid UTF-8 characters resulting from a string that does not fit in the buffer will be discarded.

Parameters
keyThe name of the system property (UTF-8 string)
[out]bufferThe buffer to store the system property (UTF-8 string)
buffer_sizeThe buffer's size.
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

◆ dxfc_system_set_property()

dxfc_error_code_t dxfc_system_set_property ( const char * key,
const char * value )

Sets the system property indicated by the specified key.

Parameters
keyThe name of the system property (UTF-8 string).
valueThe value of the system property (UTF-8 string).
Returns
DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.

References DXFC_EC_ERROR, DXFC_EC_SUCCESS, and System::setProperty().