Diffusion C API
6.8.3
|
Remote Servers feature. More...
Data Structures | |
struct | diffusion_create_remote_server_params_s |
struct | diffusion_remove_remote_server_params_s |
struct | diffusion_list_remote_servers_params_s |
struct | diffusion_check_remote_server_params_s |
Typedefs | |
typedef struct DIFFUSION_REMOTE_SERVER_T | DIFFUSION_REMOTE_SERVER_T |
Opaque remote server struct. More... | |
typedef struct DIFFUSION_REMOTE_SERVER_BUILDER_T | DIFFUSION_REMOTE_SERVER_BUILDER_T |
Opaque remote server builder struct. More... | |
typedef int(* | on_remote_server_created_cb )(DIFFUSION_REMOTE_SERVER_T *remote_server, LIST_T *errors, void *context) |
Callback when a remote server creation attempt has been made. More... | |
typedef int(* | on_remote_server_removed_cb )(void *context) |
Callback when a remote server removal attempt has been made. More... | |
typedef int(* | on_remote_servers_listed_cb )(LIST_T *remote_servers, void *context) |
Callback when a response is received from the server, returning a list of remote servers. More... | |
typedef struct DIFFUSION_CHECK_REMOTE_SERVER_RESPONSE_T | DIFFUSION_CHECK_REMOTE_SERVER_RESPONSE_T |
Opaque check remote server response struct. | |
typedef int(* | on_remote_server_checked_cb )(DIFFUSION_CHECK_REMOTE_SERVER_RESPONSE_T *response, void *context) |
Callback when a response is received from the server, returning the details of the remote server state. More... | |
Remote Servers feature.
This feature allows a client session to manage remote servers.
A remote server provides the configuration to connect to a Diffusion server belonging to a different cluster. Each server in the local cluster will establish a session with each remote server.
Higher level components, such as remote topic views, can specify the use of such remote servers by name. The connecting and disconnecting is handled automatically by the server (or servers in the same cluster) where the remote servers are defined.
A component can specify a remote server by name even if it does not exist (has not yet been created) and when the remote server is created the connection will take place automatically.
If a remote server is removed and there are components that depend upon it, those components will be disabled.
An example of the use of remote servers is within remote topic views (those that indicate that their source topics are to be taken from a different server) where the name of such a server can be specified.
Remote server configurations created through this feature are replicated across a cluster and persisted to disk.
The following access control restrictions are applied:
GLOBAL_PERMISSION_CONTROL_SERVER
permission. GLOBAL_PERMISSION_VIEW_SERVER
permission. Opaque remote server builder struct.
typedef struct DIFFUSION_REMOTE_SERVER_T DIFFUSION_REMOTE_SERVER_T |
Opaque remote server struct.
typedef int(* on_remote_server_checked_cb)(DIFFUSION_CHECK_REMOTE_SERVER_RESPONSE_T *response, void *context) |
Callback when a response is received from the server, returning the details of the remote server state.
response | The response from the server |
context | User supplied context. |
typedef int(* on_remote_server_created_cb)(DIFFUSION_REMOTE_SERVER_T *remote_server, LIST_T *errors, void *context) |
Callback when a remote server creation attempt has been made.
If the remote server definition is nil, this could mean an error has occured. These may include:
GLOBAL_PERMISSION_CONTROL_SERVER
permission remote_server | The remote server created if no errors are returned |
errors | Errors encounted during the attempted creation of the remote server |
context | User supplied context. |
typedef int(* on_remote_server_removed_cb)(void *context) |
Callback when a remote server removal attempt has been made.
context | User supplied context. |
typedef int(* on_remote_servers_listed_cb)(LIST_T *remote_servers, void *context) |
Callback when a response is received from the server, returning a list of remote servers.
remote_servers | The list of remote servers |
context | User supplied context. |
bool diffusion_check_remote_server | ( | SESSION_T * | session, |
const DIFFUSION_CHECK_REMOTE_SERVER_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Checks the current state of a named remote server.
session | The current session. If NULL, this function returns immediately. |
params | Parameters defining the diffusion_check_remote_server request and callbacks. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. char* diffusion_check_remote_server_response_get_failure_message | ( | DIFFUSION_CHECK_REMOTE_SERVER_RESPONSE_T * | response | ) |
Returns a memory allocated copy of the check remote server response failure message.
`free` should be called on this pointer when no longer needed.
response | the check remote server response |
DIFFUSION_REMOTE_SERVER_CONNECTION_STATE_T diffusion_check_remote_server_response_get_state | ( | DIFFUSION_CHECK_REMOTE_SERVER_RESPONSE_T * | response | ) |
Returns the state of the connection of the remote server.
response | the check remote server response |
bool diffusion_create_remote_server | ( | SESSION_T * | session, |
const DIFFUSION_CREATE_REMOTE_SERVER_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Create a new remote server instance with default connection options.
If a remote server with the same name already exists an error will be returned.
session | The current session. If NULL, this function returns immediately. |
params | Parameters defining the diffusion_create_remote_server request and callbacks. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. bool diffusion_list_remote_servers | ( | SESSION_T * | session, |
const DIFFUSION_LIST_REMOTE_SERVERS_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Lists all the remote servers that have been created.
session | The current session. If NULL, this function returns immediately. |
params | Parameters defining the diffusion_list_remote_servers request and callbacks. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. DIFFUSION_REMOTE_SERVER_BUILDER_T* diffusion_remote_server_builder_connection_option | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder, |
DIFFUSION_REMOTE_SERVER_CONNECTION_OPTION_T | option, | ||
char * | value | ||
) |
Specifies a single connection option.
This will add to the options currently specified to this builder, or will replace a value if it has already been specified.
builder | the remote server builder. |
option | the connection option |
value | the connection option value or NULL to remove the option. |
DIFFUSION_REMOTE_SERVER_BUILDER_T* diffusion_remote_server_builder_connection_options | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder, |
HASH_NUM_T * | connection_options | ||
) |
Specifies a map of DIFFUSION_REMOTE_SERVER_CONNECTION_OPTION_T settings.
This will replace any options currently set for this builder. Any options not supplied will take their default values. If no connection options are specified, either using this method or diffusion_remote_server_builder_connection_option then all options will take their default value.
builder | the remote server builder. |
connection_options | map of options. |
DIFFUSION_REMOTE_SERVER_T* diffusion_remote_server_builder_create | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder, |
char * | name, | ||
char * | url, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Creates a remote server struct using the current values known to this builder.
builder | the remote server builder. |
name | the name of the remote server. |
url | the URL to use to connect to the primary server. |
api_error | populated on API error. Can be NULL. |
api_error pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
.
6.7
DIFFUSION_REMOTE_SERVER_BUILDER_T* diffusion_remote_server_builder_credentials | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder, |
CREDENTIALS_T * | credentials | ||
) |
Specifies the credentials to use when connecting to the primary server.
The default, if not specified, is NONE.
builder | the remote server builder. |
credentials | the credentials to use. |
void diffusion_remote_server_builder_free | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder | ) |
Free a remote server builder.
builder | the remote server builder. |
DIFFUSION_REMOTE_SERVER_BUILDER_T* diffusion_remote_server_builder_init | ( | ) |
Initialize a new remote server builder.
<code>diffusion_remote_server_builder_free</code> should be called on this pointer when no longer needed.
DIFFUSION_REMOTE_SERVER_BUILDER_T* diffusion_remote_server_builder_missing_topic_notification_filter | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder, |
char * | filter | ||
) |
Specifies a topic selector expression which will filter missing topic notifications propagated from secondary to primary server.
Missing topic notifications are notified when a client subscribes using a topic selector that matches no existing topics. By specifying a missing topic selector filter, all notifications that match the filter on the secondary server will be propagated to the primary server.
A match occurs if the path prefix of the subscription selector matches the path prefix of the specified selector. If no filter is specified then no missing topic notifications will be propagated.
The special selector expressions *.*
may be used to indicate that all missing topic notifications should be propagated.
Only the path prefix of the specified selector(s) is considered when matching, therefore any use of regular expressions would be ignored.
builder | the remote server builder. |
filter | a topic selector expression specifying the filter to apply, or NULL to remove any existing filter. |
DIFFUSION_REMOTE_SERVER_BUILDER_T* diffusion_remote_server_builder_principal | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder, |
char * | principal | ||
) |
Specifies the name of a principal used by the remote server to connect to the primary server.
The default, if not specified, is the anonymous principal.
builder | the remote server builder. |
principal | pricipal name or a zero length string to indicate an anonymous connection. |
DIFFUSION_REMOTE_SERVER_BUILDER_T* diffusion_remote_server_builder_reset | ( | DIFFUSION_REMOTE_SERVER_BUILDER_T * | builder | ) |
Reset the builder.
builder | the remote server builder. |
void diffusion_remote_server_free | ( | DIFFUSION_REMOTE_SERVER_T * | remote_server | ) |
Free a remote server.
remote_server | the remote server. |
HASH_NUM_T* diffusion_remote_server_get_connection_options | ( | DIFFUSION_REMOTE_SERVER_T * | remote_server | ) |
Returns the remote server connection options.
hash_num_free
should be called on this pointer when no longer needed.
remote_server | the remote server. |
char* diffusion_remote_server_get_missing_topic_notification_filter | ( | DIFFUSION_REMOTE_SERVER_T * | remote_server | ) |
Return the missing topic notification filter expression or NULL if one has not been specified.
free
should be called on this pointer when no longer needed, if not NULL.
remote_server | the remote server. |
char* diffusion_remote_server_get_name | ( | DIFFUSION_REMOTE_SERVER_T * | remote_server | ) |
Returns the remote server name.
free
should be called on this pointer when no longer needed.
remote_server | the remote server. |
char* diffusion_remote_server_get_principal | ( | DIFFUSION_REMOTE_SERVER_T * | remote_server | ) |
Returns the principal used for the remote server connection.
free
should be called on this pointer when no longer needed.
remote_server | the remote server. |
char* diffusion_remote_server_get_url | ( | DIFFUSION_REMOTE_SERVER_T * | remote_server | ) |
Returns the url for connection to primary server.
free
should be called on this pointer when no longer needed.
remote_server | the remote server. |
bool diffusion_remove_remote_server | ( | SESSION_T * | session, |
const DIFFUSION_REMOVE_REMOTE_SERVER_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Remove a named remote server if it exists.
If the named remote server does not exist the callback will return without an error
When a named remote server is removed, any components that specify it would be disabled.
session | The current session. If NULL, this function returns immediately. |
params | Parameters defining the diffusion_remove_remote_server request and callbacks. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
.