|
dxFeed Graal Native SDK 3.10.0
|
The endpoint (Java DXEndpoint): a connection to a data feed or to a publisher, its role and state, and the access to its feed and publisher. More...
Topics | |
| Endpoint builder | |
| The builder of endpoints (Java DXEndpoint.Builder). | |
Data Structures | |
| struct | dxfg_endpoint_t |
| A handle of a Java DXEndpoint object; release it with dxfg_JavaObjectHandler_release(). More... | |
| struct | dxfg_endpoint_builder_t |
| A handle of a Java DXEndpoint.Builder object; release it with dxfg_JavaObjectHandler_release(). More... | |
| struct | dxfg_endpoint_state_change_listener_t |
| A handle of a Java PropertyChangeListener object that reports the state changes of an endpoint; release it with dxfg_JavaObjectHandler_release(). More... | |
Typedefs | |
| typedef struct dxfg_feed_t | dxfg_feed_t |
| Forward declaration of the handle of a Java DXFeed object (see dxfg_feed.h): the result of dxfg_DXEndpoint_getFeed(). | |
| typedef struct dxfg_publisher_t | dxfg_publisher_t |
| Forward declaration of the handle of a Java DXPublisher object (see dxfg_publisher.h): the result of dxfg_DXEndpoint_getPublisher(). | |
| typedef struct dxfg_event_clazz_list_t | dxfg_event_clazz_list_t |
| Forward declaration of the list of event classes (see dxfg_events.h): the result of dxfg_DXEndpoint_getEventTypes(). | |
| typedef struct dxfg_endpoint_t | dxfg_endpoint_t |
| A handle of a Java DXEndpoint object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef struct dxfg_endpoint_builder_t | dxfg_endpoint_builder_t |
| A handle of a Java DXEndpoint.Builder object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef struct dxfg_endpoint_state_change_listener_t | dxfg_endpoint_state_change_listener_t |
| A handle of a Java PropertyChangeListener object that reports the state changes of an endpoint; release it with dxfg_JavaObjectHandler_release(). | |
| typedef enum dxfg_endpoint_role_t | dxfg_endpoint_role_t |
| The role of an endpoint: it is specified when the endpoint is created and cannot be changed afterwards. | |
| typedef enum dxfg_endpoint_state_t | dxfg_endpoint_state_t |
| The state of an endpoint, see dxfg_DXEndpoint_getState(). | |
| typedef void(*) | dxfg_endpoint_state_change_listener_func(graal_isolatethread_t *thread, dxfg_endpoint_state_t old_state, dxfg_endpoint_state_t new_state, void *user_data) |
| The function of a dxfg_endpoint_state_change_listener_t: called when the state of the endpoint changes. | |
Enumerations | |
| enum | dxfg_endpoint_role_t { DXFG_ENDPOINT_ROLE_FEED = 0 , DXFG_ENDPOINT_ROLE_ON_DEMAND_FEED , DXFG_ENDPOINT_ROLE_STREAM_FEED , DXFG_ENDPOINT_ROLE_PUBLISHER , DXFG_ENDPOINT_ROLE_STREAM_PUBLISHER , DXFG_ENDPOINT_ROLE_LOCAL_HUB } |
| The role of an endpoint: it is specified when the endpoint is created and cannot be changed afterwards. More... | |
| enum | dxfg_endpoint_state_t { DXFG_ENDPOINT_STATE_NOT_CONNECTED = 0 , DXFG_ENDPOINT_STATE_CONNECTING , DXFG_ENDPOINT_STATE_CONNECTED , DXFG_ENDPOINT_STATE_CLOSED } |
| The state of an endpoint, see dxfg_DXEndpoint_getState(). More... | |
Functions | |
| dxfg_endpoint_t * | dxfg_DXEndpoint_getInstance (graal_isolatethread_t *thread) |
| Returns the default application-wide singleton endpoint with the DXFG_ENDPOINT_ROLE_FEED role, the same one that dxfg_DXFeed_getInstance() uses. | |
| dxfg_endpoint_t * | dxfg_DXEndpoint_getInstance2 (graal_isolatethread_t *thread, dxfg_endpoint_role_t role) |
| Creates a new endpoint with the given role on every call, the same as dxfg_DXEndpoint_create2(). | |
| dxfg_endpoint_t * | dxfg_DXEndpoint_create (graal_isolatethread_t *thread) |
| Creates a new endpoint with the DXFG_ENDPOINT_ROLE_FEED role. | |
| dxfg_endpoint_t * | dxfg_DXEndpoint_create2 (graal_isolatethread_t *thread, dxfg_endpoint_role_t role) |
| Creates a new endpoint with the given role. | |
| int32_t | dxfg_DXEndpoint_close (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Closes the endpoint: disconnects it and releases its resources. The endpoint cannot be used after that. | |
| int32_t | dxfg_DXEndpoint_closeAndAwaitTermination (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Closes the endpoint and waits until all the data processing and the scheduled notifications are completed. | |
| dxfg_endpoint_role_t | dxfg_DXEndpoint_getRole (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Returns the role of the endpoint. | |
| int32_t | dxfg_DXEndpoint_user (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint, const char *user) |
| Sets the user name of the endpoint. | |
| int32_t | dxfg_DXEndpoint_password (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint, const char *password) |
| Sets the password of the endpoint. | |
| int32_t | dxfg_DXEndpoint_connect (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint, const char *address) |
| Connects the endpoint to the remote address. | |
| int32_t | dxfg_DXEndpoint_reconnect (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Terminates all the network connections of the endpoint and initiates connecting again with the same address. | |
| int32_t | dxfg_DXEndpoint_disconnect (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Terminates all the remote network connections of the endpoint. | |
| int32_t | dxfg_DXEndpoint_disconnectAndClear (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Terminates all the remote network connections of the endpoint and clears the stored data. | |
| int32_t | dxfg_DXEndpoint_awaitProcessed (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Waits until the endpoint stops processing data (becomes quiescent). | |
| int32_t | dxfg_DXEndpoint_awaitNotConnected (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Waits until the state of the endpoint becomes DXFG_ENDPOINT_STATE_NOT_CONNECTED or DXFG_ENDPOINT_STATE_CLOSED. | |
| dxfg_endpoint_state_t | dxfg_DXEndpoint_getState (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Returns the state of the endpoint. | |
| int32_t | dxfg_DXEndpoint_addStateChangeListener (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint, dxfg_endpoint_state_change_listener_t *listener) |
| Adds the state change listener (see dxfg_PropertyChangeListener_new()). | |
| int32_t | dxfg_DXEndpoint_removeStateChangeListener (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint, dxfg_endpoint_state_change_listener_t *listener) |
| Removes the state change listener that was added with dxfg_DXEndpoint_addStateChangeListener(). | |
| dxfg_feed_t * | dxfg_DXEndpoint_getFeed (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Returns the feed of the endpoint. | |
| dxfg_publisher_t * | dxfg_DXEndpoint_getPublisher (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Returns the publisher of the endpoint. | |
| int32_t | dxfg_DXEndpoint_executor (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint, dxfg_executor_t *executor) |
| Changes the executor of the endpoint's notifications. | |
| dxfg_event_clazz_list_t * | dxfg_DXEndpoint_getEventTypes (graal_isolatethread_t *thread, dxfg_endpoint_t *endpoint) |
| Returns the event types that the endpoint supports. | |
| dxfg_endpoint_state_change_listener_t * | dxfg_PropertyChangeListener_new (graal_isolatethread_t *thread, dxfg_endpoint_state_change_listener_func user_func, void *user_data) |
| Creates a new endpoint state change listener. | |
The endpoint (Java DXEndpoint): a connection to a data feed or to a publisher, its role and state, and the access to its feed and publisher.
The ownership rules of the handles, the strings and the lists are described in the group Javac.
A typical life cycle of an endpoint:
| typedef struct dxfg_endpoint_builder_t dxfg_endpoint_builder_t |
A handle of a Java DXEndpoint.Builder object; release it with dxfg_JavaObjectHandler_release().
Create it with dxfg_DXEndpoint_newBuilder(). The endpoints that the builder has built are independent of it: releasing the builder's handle does not affect them.
| typedef enum dxfg_endpoint_role_t dxfg_endpoint_role_t |
The role of an endpoint: it is specified when the endpoint is created and cannot be changed afterwards.
The role defines what dxfg_DXEndpoint_connect() connects to and which of dxfg_DXEndpoint_getFeed() and dxfg_DXEndpoint_getPublisher() is meaningful. The default role is DXFG_ENDPOINT_ROLE_FEED.
Java: DXEndpoint.Role.
| typedef void(*) dxfg_endpoint_state_change_listener_func(graal_isolatethread_t *thread, dxfg_endpoint_state_t old_state, dxfg_endpoint_state_t new_state, void *user_data) |
The function of a dxfg_endpoint_state_change_listener_t: called when the state of the endpoint changes.
The function is called by a thread of the executor of the endpoint (the default thread pool or the executor that was set with dxfg_DXEndpoint_Builder_withExecutor()), not by the thread that added the listener or changed the state. A change is reported from the last reported state to the current one, so the fast changes are coalesced (see dxfg_DXEndpoint_addStateChangeListener()). The states are passed by value, there is nothing to release. Do not call dxfg_DXEndpoint_closeAndAwaitTermination() of the same endpoint from the function.
Java: PropertyChangeListener.propertyChange(PropertyChangeEvent).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | old_state | The previous state of the endpoint. |
| [in] | new_state | The new state of the endpoint. |
| [in] | user_data | The pointer that was passed to dxfg_PropertyChangeListener_new(); the SDK does not use it. |
| typedef struct dxfg_endpoint_state_change_listener_t dxfg_endpoint_state_change_listener_t |
A handle of a Java PropertyChangeListener object that reports the state changes of an endpoint; release it with dxfg_JavaObjectHandler_release().
The listener calls a dxfg_endpoint_state_change_listener_func when the state of an endpoint to which it is added changes. Create it with dxfg_PropertyChangeListener_new() and add it with dxfg_DXEndpoint_addStateChangeListener(). The last handle of the listener that is released deactivates the listener: its function is not called anymore.
| typedef enum dxfg_endpoint_state_t dxfg_endpoint_state_t |
The state of an endpoint, see dxfg_DXEndpoint_getState().
An endpoint is created DXFG_ENDPOINT_STATE_NOT_CONNECTED, unless it connects on creation (see dxfg_DXEndpoint_Builder_build()). dxfg_DXEndpoint_connect() makes it DXFG_ENDPOINT_STATE_CONNECTING, the established connection makes it DXFG_ENDPOINT_STATE_CONNECTED, a lost network connection returns it to DXFG_ENDPOINT_STATE_CONNECTING. DXFG_ENDPOINT_STATE_CLOSED is the final state.
Java: DXEndpoint.State.
| typedef struct dxfg_endpoint_t dxfg_endpoint_t |
A handle of a Java DXEndpoint object; release it with dxfg_JavaObjectHandler_release().
Create it with dxfg_DXEndpoint_Builder_build(), dxfg_DXEndpoint_create(), dxfg_DXEndpoint_create2() or get the default one with dxfg_DXEndpoint_getInstance(). Releasing the handle does not close the endpoint: call dxfg_DXEndpoint_close() or dxfg_DXEndpoint_closeAndAwaitTermination().
| typedef struct dxfg_event_clazz_list_t dxfg_event_clazz_list_t |
Forward declaration of the list of event classes (see dxfg_events.h): the result of dxfg_DXEndpoint_getEventTypes().
| typedef struct dxfg_feed_t dxfg_feed_t |
Forward declaration of the handle of a Java DXFeed object (see dxfg_feed.h): the result of dxfg_DXEndpoint_getFeed().
| typedef struct dxfg_publisher_t dxfg_publisher_t |
Forward declaration of the handle of a Java DXPublisher object (see dxfg_publisher.h): the result of dxfg_DXEndpoint_getPublisher().
| enum dxfg_endpoint_role_t |
The role of an endpoint: it is specified when the endpoint is created and cannot be changed afterwards.
The role defines what dxfg_DXEndpoint_connect() connects to and which of dxfg_DXEndpoint_getFeed() and dxfg_DXEndpoint_getPublisher() is meaningful. The default role is DXFG_ENDPOINT_ROLE_FEED.
Java: DXEndpoint.Role.
| Enumerator | |
|---|---|
| DXFG_ENDPOINT_ROLE_FEED | Connects to a remote data feed provider; optimized for real-time or delayed data. The default role. The events are conflated when the event processing cannot keep up. |
| DXFG_ENDPOINT_ROLE_ON_DEMAND_FEED | Similar to DXFG_ENDPOINT_ROLE_FEED, but only for the replay of historical data with the on-demand service: it is not connected to the data provider until the replay is started. It cannot be connected to an ordinary data feed. |
| DXFG_ENDPOINT_ROLE_STREAM_FEED | Similar to DXFG_ENDPOINT_ROLE_FEED, but designed for bulk parsing of data from files: the events are not conflated and not skipped and are processed as fast as possible. The last event requests do not work in this role. |
| DXFG_ENDPOINT_ROLE_PUBLISHER | Connects to a remote publisher hub or creates a publisher on the local host; the publisher of the endpoint publishes the events to all the connected feeds. The last event requests and the time series subscription do not work in this role. |
| DXFG_ENDPOINT_ROLE_STREAM_PUBLISHER | Similar to DXFG_ENDPOINT_ROLE_PUBLISHER, but designed for bulk publishing: the events are not conflated and not skipped and are processed as fast as possible. |
| DXFG_ENDPOINT_ROLE_LOCAL_HUB | A local hub without the network connections: the events published with the publisher of the endpoint are delivered to the feed of the same endpoint only. |
The state of an endpoint, see dxfg_DXEndpoint_getState().
An endpoint is created DXFG_ENDPOINT_STATE_NOT_CONNECTED, unless it connects on creation (see dxfg_DXEndpoint_Builder_build()). dxfg_DXEndpoint_connect() makes it DXFG_ENDPOINT_STATE_CONNECTING, the established connection makes it DXFG_ENDPOINT_STATE_CONNECTED, a lost network connection returns it to DXFG_ENDPOINT_STATE_CONNECTING. DXFG_ENDPOINT_STATE_CLOSED is the final state.
Java: DXEndpoint.State.
| Enumerator | |
|---|---|
| DXFG_ENDPOINT_STATE_NOT_CONNECTED | The endpoint is not connected to a remote endpoint: it is just created, or was disconnected, or a file that it read is finished. |
| DXFG_ENDPOINT_STATE_CONNECTING | dxfg_DXEndpoint_connect() was called, but the connection is not established yet or was lost. |
| DXFG_ENDPOINT_STATE_CONNECTED | The connection to a remote endpoint is established. |
| DXFG_ENDPOINT_STATE_CLOSED | The endpoint was closed by dxfg_DXEndpoint_close(); no connection can be made anymore. |
| int32_t dxfg_DXEndpoint_addStateChangeListener | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint, | ||
| dxfg_endpoint_state_change_listener_t * | listener ) |
Adds the state change listener (see dxfg_PropertyChangeListener_new()).
The state changes are delivered by a single task on the endpoint's executor that reports the change from the last reported state to the current one, so the fast changes are coalesced (e.g. DXFG_ENDPOINT_STATE_NOT_CONNECTED -> DXFG_ENDPOINT_STATE_CONNECTED without DXFG_ENDPOINT_STATE_CONNECTING). A notification may come after dxfg_DXEndpoint_close() or dxfg_DXEndpoint_removeStateChangeListener() returns.
The listener stays added until it is removed with dxfg_DXEndpoint_removeStateChangeListener(); releasing the last handle of the listener only deactivates it.
Java: DXEndpoint.addStateChangeListener(PropertyChangeListener).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| [in] | listener | The listener. The caller keeps its handle. |
| int32_t dxfg_DXEndpoint_awaitNotConnected | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Waits until the state of the endpoint becomes DXFG_ENDPOINT_STATE_NOT_CONNECTED or DXFG_ENDPOINT_STATE_CLOSED.
It is the signal that the files opened with dxfg_DXEndpoint_connect() (file:... addresses) were finished reading, but not necessarily completely processed by the subscription listeners. Call dxfg_DXEndpoint_closeAndAwaitTermination() after it returns to make sure that all the processing has completed.
The function blocks the calling thread. With a single-threaded executor of the endpoint, do not call it from the executor's thread (e.g. from a listener): it would wait forever.
Java: DXEndpoint.awaitNotConnected().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_awaitProcessed | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Waits until the endpoint stops processing data (becomes quiescent).
It is important when data is written to a file with a tape:... address: wait for it to make sure that all the published data was written before closing the endpoint.
The function blocks the calling thread. With a single-threaded executor of the endpoint, do not call it from the executor's thread (e.g. from a listener): it would wait forever.
Java: DXEndpoint.awaitProcessed().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_close | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Closes the endpoint: disconnects it and releases its resources. The endpoint cannot be used after that.
The state of the endpoint becomes DXFG_ENDPOINT_STATE_CLOSED immediately.
The function does not wait for the notifications that are already scheduled: a state change listener (including the change to DXFG_ENDPOINT_STATE_CLOSED) or an event listener may still be called after it returns. Use dxfg_DXEndpoint_closeAndAwaitTermination() to wait for them, or dxfg_JavaObjectHandler_release() of the listener to stop its calls (see dxfg_JavaObjectHandler_release()).
Java: DXEndpoint.close().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_closeAndAwaitTermination | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Closes the endpoint and waits until all the data processing and the scheduled notifications are completed.
It does the same as dxfg_DXEndpoint_close() and blocks until the outstanding tasks of the endpoint are finished. It is designed for the DXFG_ENDPOINT_ROLE_STREAM_FEED role, after dxfg_DXEndpoint_awaitNotConnected() returns, to make sure that a file was completely processed.
Do not call it from a listener of this endpoint: it would wait for the notification that is calling it.
Java: DXEndpoint.closeAndAwaitTermination().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_connect | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint, | ||
| const char * | address ) |
Connects the endpoint to the remote address.
The previously established connections are closed if the new address is different from the old one. The function does nothing if the address does not change or if the endpoint is closed. Otherwise, the state of the endpoint immediately becomes DXFG_ENDPOINT_STATE_CONNECTING.
The function does not wait until the connection is established: it is established asynchronously. It waits only until the state change listeners have processed the change to DXFG_ENDPOINT_STATE_CONNECTING.
The address string comes with the market data vendor agreement, for example host:port to connect to a server with TCP/IP, or :port to listen for a connection. A malformed address or a NULL address is an error. For the services that require credentials call dxfg_DXEndpoint_user() and dxfg_DXEndpoint_password() first.
Java: DXEndpoint.connect(String).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| [in] | address | The address of the data source, a NUL-terminated UTF-8 string; the SDK copies it. |
| dxfg_endpoint_t * dxfg_DXEndpoint_create | ( | graal_isolatethread_t * | thread | ) |
Creates a new endpoint with the DXFG_ENDPOINT_ROLE_FEED role.
Java: DXEndpoint.create().
| [in] | thread | The current GraalVM Isolate's thread. |
| dxfg_endpoint_t * dxfg_DXEndpoint_create2 | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_role_t | role ) |
Creates a new endpoint with the given role.
Java: DXEndpoint.create(DXEndpoint.Role).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | role | The role of the endpoint. |
| int32_t dxfg_DXEndpoint_disconnect | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Terminates all the remote network connections of the endpoint.
The function does nothing if the endpoint is closed. Otherwise, the state of the endpoint immediately becomes DXFG_ENDPOINT_STATE_NOT_CONNECTED. The resources of the endpoint are not released: use dxfg_DXEndpoint_close() for that.
Java: DXEndpoint.disconnect().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_disconnectAndClear | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Terminates all the remote network connections of the endpoint and clears the stored data.
The function does nothing if the endpoint is closed. Otherwise, the state of the endpoint immediately becomes DXFG_ENDPOINT_STATE_NOT_CONNECTED. The resources of the endpoint are not released: use dxfg_DXEndpoint_close() for that.
Java: DXEndpoint.disconnectAndClear().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_executor | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint, | ||
| dxfg_executor_t * | executor ) |
Changes the executor of the endpoint's notifications.
The executor runs all the asynchronous interaction with the user code: event processing, state changes, etc.
Call it before dxfg_DXEndpoint_getFeed() (and before the other functions that use the endpoint's feed, e.g. dxfg_OnDemandService_getInstance2()). Otherwise, the feed keeps using the default executor, which is shut down, and the last events requests (dxfg_DXFeed_getLastEventPromise(), etc.) never complete (a RejectedExecutionException is logged).
The executor must not reject the submitted tasks. A NULL executor is an error.
Java: DXEndpoint.executor(Executor).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| [in] | executor | The executor. The endpoint does not take the handle: free it with dxfg_JavaObjectHandler_release() when it is no longer needed. |
| dxfg_event_clazz_list_t * dxfg_DXEndpoint_getEventTypes | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Returns the event types that the endpoint supports.
The result is the set of the event types supported by the endpoint and by the current version of the dxFeed Graal Native SDK; the event types that the SDK does not know are left out.
Java: DXEndpoint.getEventTypes().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| dxfg_feed_t * dxfg_DXEndpoint_getFeed | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Returns the feed of the endpoint.
The feed is associated with the endpoint: it receives the events from the endpoint's connection. Releasing the handle of the feed does not affect the endpoint.
Java: DXEndpoint.getFeed().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| dxfg_endpoint_t * dxfg_DXEndpoint_getInstance | ( | graal_isolatethread_t * | thread | ) |
Returns the default application-wide singleton endpoint with the DXFG_ENDPOINT_ROLE_FEED role, the same one that dxfg_DXFeed_getInstance() uses.
The endpoint is created on the first call and is configured by the properties of the endpoint and the system properties (see dxfg_system_set_property()) as of that moment.
All callers share this endpoint: closing it closes it for everyone in the process.
Java: DXEndpoint.getInstance().
| [in] | thread | The current GraalVM Isolate's thread. |
| dxfg_endpoint_t * dxfg_DXEndpoint_getInstance2 | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_role_t | role ) |
Creates a new endpoint with the given role on every call, the same as dxfg_DXEndpoint_create2().
Unlike the Java DXEndpoint.getInstance(Role), this function does not return a singleton: the SDK calls DXEndpoint.create(Role). Prefer dxfg_DXEndpoint_newBuilder() (or dxfg_DXEndpoint_create2()) in the new code.
Java: DXEndpoint.create(DXEndpoint.Role).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | role | The role of the endpoint. |
| dxfg_publisher_t * dxfg_DXEndpoint_getPublisher | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Returns the publisher of the endpoint.
The publisher is associated with the endpoint: it publishes the events to the endpoint's connection. Releasing the handle of the publisher does not affect the endpoint.
Java: DXEndpoint.getPublisher().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| dxfg_endpoint_role_t dxfg_DXEndpoint_getRole | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Returns the role of the endpoint.
Java: DXEndpoint.getRole().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| dxfg_endpoint_state_t dxfg_DXEndpoint_getState | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Returns the state of the endpoint.
Java: DXEndpoint.getState().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_password | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint, | ||
| const char * | password ) |
Sets the password of the endpoint.
Call it before dxfg_DXEndpoint_connect(), together with dxfg_DXEndpoint_user(), to configure the credentials of a service that requires them. A NULL password is an error.
Java: DXEndpoint.password(String).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| [in] | password | The password, a NUL-terminated UTF-8 string; the SDK copies it. |
| int32_t dxfg_DXEndpoint_reconnect | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint ) |
Terminates all the network connections of the endpoint and initiates connecting again with the same address.
It works like dxfg_DXEndpoint_disconnect() followed by dxfg_DXEndpoint_connect() with the current address, but the internal resources may be reused. A connection with several target addresses tries to switch to an alternative address; the configured reconnect timeouts apply.
The function does not connect an endpoint that was not connected with dxfg_DXEndpoint_connect() or was disconnected with dxfg_DXEndpoint_disconnect(). Whether a state change listener sees the intermediate DXFG_ENDPOINT_STATE_NOT_CONNECTED state is not specified.
Java: DXEndpoint.reconnect().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| int32_t dxfg_DXEndpoint_removeStateChangeListener | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint, | ||
| dxfg_endpoint_state_change_listener_t * | listener ) |
Removes the state change listener that was added with dxfg_DXEndpoint_addStateChangeListener().
A notification that is already scheduled may still reach the listener after the function returns: release the listener's handle with dxfg_JavaObjectHandler_release() (or deactivate it with dxfg_NativeListener_deactivate()) to be sure that its function is not called anymore. The function does not release the handle.
Java: DXEndpoint.removeStateChangeListener(PropertyChangeListener).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| [in] | listener | The listener to remove. The caller keeps its handle. |
| int32_t dxfg_DXEndpoint_user | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_t * | endpoint, | ||
| const char * | user ) |
Sets the user name of the endpoint.
Call it before dxfg_DXEndpoint_connect(), together with dxfg_DXEndpoint_password(), to configure the credentials of a service that requires them. A NULL user name is an error.
Java: DXEndpoint.user(String).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | endpoint | The endpoint. |
| [in] | user | The user name, a NUL-terminated UTF-8 string; the SDK copies it. |
| dxfg_endpoint_state_change_listener_t * dxfg_PropertyChangeListener_new | ( | graal_isolatethread_t * | thread, |
| dxfg_endpoint_state_change_listener_func | user_func, | ||
| void * | user_data ) |
Creates a new endpoint state change listener.
The listener does nothing until it is added to an endpoint with dxfg_DXEndpoint_addStateChangeListener(). The function is called as described at dxfg_endpoint_state_change_listener_func.
Releasing the last handle of the listener with dxfg_JavaObjectHandler_release() (or dxfg_NativeListener_deactivate()) stops the calls of the function: after the release returns the function is not running and is not called anymore, so the user data can be freed. Remove the listener from the endpoint as well, otherwise it stays added and does nothing.
Java: PropertyChangeListener.propertyChange(PropertyChangeEvent).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | user_func | The function to call on the state changes (see dxfg_DXEndpoint_addStateChangeListener()). |
| [in] | user_data | The user data to pass to the function; the SDK does not use it. It must stay valid until the listener is deactivated. |