dxFeed Graal Native SDK 3.15.0-rc1
Loading...
Searching...
No Matches
Endpoint builder

The builder of endpoints (Java DXEndpoint.Builder). More...

Functions

dxfg_endpoint_builder_t * dxfg_DXEndpoint_newBuilder (graal_isolatethread_t *thread)
 Creates a new endpoint builder.
int32_t dxfg_DXEndpoint_Builder_withRole (graal_isolatethread_t *thread, dxfg_endpoint_builder_t *builder, dxfg_endpoint_role_t role)
 Sets the role of the endpoints built by the builder.
int32_t dxfg_DXEndpoint_Builder_withName (graal_isolatethread_t *thread, dxfg_endpoint_builder_t *builder, const char *name)
 Sets the name of the endpoints built by the builder.
int32_t dxfg_DXEndpoint_Builder_withProperty (graal_isolatethread_t *thread, dxfg_endpoint_builder_t *builder, const char *key, const char *value)
 Sets a property of the endpoints built by the builder.
int32_t dxfg_DXEndpoint_Builder_withProperties (graal_isolatethread_t *thread, dxfg_endpoint_builder_t *builder, const char *file_path)
 Sets the properties of the endpoints built by the builder from a properties file.
int32_t dxfg_DXEndpoint_Builder_withExecutor (graal_isolatethread_t *thread, dxfg_endpoint_builder_t *builder, dxfg_executor_t *executor)
 Sets the executor of the notifications of the endpoints built by this builder: event processing, state changes, etc.
int32_t dxfg_DXEndpoint_Builder_supportsProperty (graal_isolatethread_t *thread, dxfg_endpoint_builder_t *builder, const char *key)
 Checks whether the builder supports a property.
dxfg_endpoint_t * dxfg_DXEndpoint_Builder_build (graal_isolatethread_t *thread, dxfg_endpoint_builder_t *builder)
 Builds a new endpoint with the builder's settings.

Detailed Description

The builder of endpoints (Java DXEndpoint.Builder).

The recommended way to create an endpoint: the builder allows to set the role, the name, the executor and the properties (see DXEndpoint.Builder). Every dxfg_DXEndpoint_Builder_build() call creates a new endpoint.

Function Documentation

◆ dxfg_DXEndpoint_Builder_build()

dxfg_endpoint_t * dxfg_DXEndpoint_Builder_build ( graal_isolatethread_t * thread,
dxfg_endpoint_builder_t * builder )

Builds a new endpoint with the builder's settings.

Every call builds a new endpoint. An endpoint with the role DXFG_ENDPOINT_ROLE_FEED or DXFG_ENDPOINT_ROLE_PUBLISHER connects automatically on creation if dxfeed.address (feed) or dxpublisher.address (publisher) is set; the endpoints of the other roles do not.

Java: DXEndpoint.Builder.build().

Deprecated
Use dxfg_v4_DXEndpoint_Builder_build().
Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]builderThe builder.
Returns
The new endpoint, or NULL on error. Use dxfg_get_and_clear_thread_exception_t() to get the exception. The caller owns the endpoint: close it with dxfg_DXEndpoint_close() or dxfg_DXEndpoint_closeAndAwaitTermination() and free its handle with dxfg_JavaObjectHandler_release() (releasing the handle does not close the endpoint).

◆ dxfg_DXEndpoint_Builder_supportsProperty()

int32_t dxfg_DXEndpoint_Builder_supportsProperty ( graal_isolatethread_t * thread,
dxfg_endpoint_builder_t * builder,
const char * key )

Checks whether the builder supports a property.

The properties that are not supported are ignored by dxfg_DXEndpoint_Builder_withProperty().

Java: DXEndpoint.Builder.supportsProperty(String).

Deprecated
Use dxfg_v4_DXEndpoint_Builder_supportsProperty().
Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]builderThe builder.
[in]keyThe name of the property, a NUL-terminated UTF-8 string.
Returns
1 if the property is supported, 0 if it is not supported, or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_get_and_clear_thread_exception_t() to determine if an exception was thrown.

◆ dxfg_DXEndpoint_Builder_withExecutor()

int32_t dxfg_DXEndpoint_Builder_withExecutor ( graal_isolatethread_t * thread,
dxfg_endpoint_builder_t * builder,
dxfg_executor_t * executor )

Sets the executor of the notifications of the endpoints built by this builder: event processing, state changes, etc.

Use it instead of the deprecated dxfg_DXEndpoint_executor().

By default, the endpoint uses a thread pool with the size equal to the number of available processors (the dxfeed.threadPoolSize property for the feed roles and dxpublisher.threadPoolSize for the publisher). The executor must not reject the submitted tasks.

Java: DXEndpoint.Builder.withExecutor(Executor).

Deprecated
Use dxfg_v4_DXEndpoint_Builder_withExecutor().
Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]builderThe builder.
[in]executorThe executor (e.g. from dxfg_Executors_newFixedThreadPool()) or NULL to use the default one. The builder does not take the handle: free it with dxfg_JavaObjectHandler_release() when it is no longer needed.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_get_and_clear_thread_exception_t() to determine if an exception was thrown.

◆ dxfg_DXEndpoint_Builder_withName()

int32_t dxfg_DXEndpoint_Builder_withName ( graal_isolatethread_t * thread,
dxfg_endpoint_builder_t * builder,
const char * name )

Sets the name of the endpoints built by the builder.

The name distinguishes several endpoints in the same process in the logs and other diagnostics. It is the same as dxfg_DXEndpoint_Builder_withProperty() with the key name. A short name that describes the role of the endpoint in the application is recommended.

Java: DXEndpoint.Builder.withName(String).

Deprecated
Use dxfg_v4_DXEndpoint_Builder_withName().
Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]builderThe builder.
[in]nameThe name, a NUL-terminated UTF-8 string; the SDK copies it.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_get_and_clear_thread_exception_t() to determine if an exception was thrown.

◆ dxfg_DXEndpoint_Builder_withProperties()

int32_t dxfg_DXEndpoint_Builder_withProperties ( graal_isolatethread_t * thread,
dxfg_endpoint_builder_t * builder,
const char * file_path )

Sets the properties of the endpoints built by the builder from a properties file.

The file is read in the format of a Java properties file (java.util.Properties.load) and every property that the builder supports is set as by dxfg_DXEndpoint_Builder_withProperty(). The unsupported properties are ignored. An error is reported if the file cannot be read.

Java: DXEndpoint.Builder.withProperties(Properties).

Deprecated
Use dxfg_v4_DXEndpoint_Builder_withProperties().
Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]builderThe builder.
[in]file_pathThe path of the properties file, a NUL-terminated UTF-8 string; the SDK copies it.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_get_and_clear_thread_exception_t() to determine if an exception was thrown.

◆ dxfg_DXEndpoint_Builder_withProperty()

int32_t dxfg_DXEndpoint_Builder_withProperty ( graal_isolatethread_t * thread,
dxfg_endpoint_builder_t * builder,
const char * key,
const char * value )

Sets a property of the endpoints built by the builder.

A property that the builder does not support is ignored: check it with dxfg_DXEndpoint_Builder_supportsProperty(). A property that is set here takes precedence over the same property from the properties file and from the system properties (see dxfg_system_set_property()).

Java: DXEndpoint.Builder.withProperty(String, String).

Deprecated
Use dxfg_v4_DXEndpoint_Builder_withProperty().
Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]builderThe builder.
[in]keyThe name of the property, a NUL-terminated UTF-8 string; the SDK copies it.
[in]valueThe value of the property, a NUL-terminated UTF-8 string; the SDK copies it.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_get_and_clear_thread_exception_t() to determine if an exception was thrown.

◆ dxfg_DXEndpoint_Builder_withRole()

int32_t dxfg_DXEndpoint_Builder_withRole ( graal_isolatethread_t * thread,
dxfg_endpoint_builder_t * builder,
dxfg_endpoint_role_t role )

Sets the role of the endpoints built by the builder.

The default role is DXFG_ENDPOINT_ROLE_FEED.

Java: DXEndpoint.Builder.withRole(DXEndpoint.Role).

Deprecated
Use dxfg_v4_DXEndpoint_Builder_withRole().
Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]builderThe builder.
[in]roleThe role of the endpoints.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_get_and_clear_thread_exception_t() to determine if an exception was thrown.

◆ dxfg_DXEndpoint_newBuilder()

dxfg_endpoint_builder_t * dxfg_DXEndpoint_newBuilder ( graal_isolatethread_t * thread)

Creates a new endpoint builder.

The builder has the DXFG_ENDPOINT_ROLE_FEED role and the default executor until they are changed.

Java: DXEndpoint.newBuilder().

Deprecated
Use dxfg_v4_DXEndpoint_newBuilder().
Parameters
[in]threadThe current GraalVM Isolate's thread.
Returns
The builder (release its handle with dxfg_JavaObjectHandler_release()), or NULL on error. Use dxfg_get_and_clear_thread_exception_t() to get the exception.