Configuring connection adapters

Here you can find instructions how to configure the connection adapter.

Server connection adapter configuration

In the server configuration xml file you can configure the connection adapter with attribute nodes. These values are passed to the adapters configure() method.

<connectionadapter type="connect.bearer.tcp" library="bearer_tcp">
    <attribute name="port" value="2002" />
</connectionadapter>

Client connection adapter configuration

In Kanzi Studio you can configure the connection adapter for the client. The available configuration options are defined by the server-side plugin in its getClientSideParameters() method.

Configuring connection adapter for peer-to-peer communication

When you use a connection adapter in a peer-to-peer communication, it is configured primarily during the service code generation phase. For explicitly defined peer-to-peer connection adapters you can add attributes in a similar way as for the server.

<p2p-endpoints>
    <!-- Dedicated TCP Link for direct runtime data -->
    <connectionadapter type="connect.bearer.tcp" library="bearer_tcp" identifier="tcp_for_runtime_data">
        <!-- base number for server ports -->
        <attribute name="port" value="12345"/>

You cannot explicitly configure the client-side peer-to-peer connection adapter. However, all configurations for the service description xml become available when you configure the client-side connection adapter.

Tip

You can programmatically configure the connection adapter during initialization phase by overriding the provideServiceRoutingInformationOverride() method which returns an xml document that describes the routing structure, including the definition of connection adapters.

Configurable attributes for connection adapters

You can configure these attributes for the built-in connection adapters:

Attribute

Description

Available for

port

Sets the TCP port number on which the connection adapter listens for incoming connections.

  • TCP

  • SSL

  • UDP

port_range_size

Sets the number of additional ports that a connection adapter tries, when the configured port is already in use. The default value is 0.

  • TCP

  • SSL

  • UDP

timeout

Sets the timeout for the server connection watchdog. If the timer expires before the server responds, the client disconnects and tries to reconnect. As a guideline, do not use values lower than 3000. The default value is 5000.

  • ALL

trace

Enables message tracing for the connection adapter. The attribute supports these values:

  • log prints the message information to the application log stream

  • detail adds BASE64 encoded messages to the application log

  • file saves the messages to a plain-text file in the application working directory. The default value is empty.

Note

Message tracing provides an effective way to debug the information that arrives and leaves an application. However, this approach comes at a significant performance cost. Use tracing only during development and make sure that you disable all message tracing in a production environment.

  • ALL

verbose

Sets whether a UDP connection adapter prints detailed debug information to the log. The default value is False (0).

UDP

max_clients

Sets the maximum number of clients allowed to connect to a UDP socket. The higher the number, the more memory is consumed. The allowed rande is from 8 to 1024 inclusive. The default value is 128.

UDP

reliable_link

Sets whether UDP uses reliable communication mode. Unreliable mode does not guarantee anything related to messaging. Use unreliable mode only for direct peer-to-peer communication between a service and its client and not for communication between a client and a server. The default is True.

UDP

Tip

Message tracing (trace) is effective way to debug the information that arrives and leaves the application, but it comes with significant performance hit. Remember to disable all message traces on production environment.

Configurable attributes for shared memory adapters

You can configure these attributes for the shared memory adapters:

Attribute

Description

name

The shared memory symbolic name to which the clients connect.

max_clients

The maximum number of clients that can communicate using the shared memory.

blocksize-tx

Sets the shared memory area size for communication from a server to a client.

blocksize-rx

Sets the shared memory area size for communication from a client to a server.

inactivity-ms

If an entity that communicates using shared memory does not update its data within this time, it is considered to be disconnected.