xSQL IoT Parameters

The xSQL configuration file can be used to define IoT (active replication) parameters corresponding to the C API structures mco_iot_comm_params_t and mco_iot_replicator_params_t.

For an overview see page Configuration File Parameters

The iot_params section consists of a set of "name : value" pairs enclosed within braces. For example:

 
    iot_params : {
        agent_id: 10024,
        listen_queue_size: 5,
        ...
    }
     

The following table lists the possible options for the iot_params section with the corresponding C API structures and values specified in the comment:

Option name : example value Comment
agent_id: 10024,

Id of this device / server; must be greater than 0 and unique for all agents (also can be specified in the schema )

level : 100, possible values are 'server', 'device' or unsigned integer between 1 and 65535
enabled: false, Allows disabling the IoT runtime at startup. The IoT can be enabled later using xsql_iot_enable() UDF. (The default value is true)
listen_queue_size : 5, Maximum length of the listen socket queue; default value is 0 (which means use a system-defined maximum)
n_callback_threads : 16,

Number of threads to process incoming request; default value is 8

recv_timeout : 2000,

Timeout for the recv() operation, in milliseconds; default value is 10*1000 (10 seconds)

send_timeout : 2000,

Timeout for the send() operation, in milliseconds; default value is 10*1000 (10 seconds)

wakeup_port : 9900,

Port number for the service port; default value 0 (means use a system-defined port number)

conn_pool_size : 16,

Maximum number of cached database connections; default value is (n_callback_threads + 2)

sync_type : "pull",

The type of automatic synchronization (see sync_on_connect and sync_period below). One of

  • push (send outgoing data),
  • pull (request for incoming data), or
  • sync (both push and pull); this is the default value

clear_on_ack : false,

Whether to remove outgoing data which were sent to and acked by the recipient; default value is false

sync_on_connect : true,

Whether to perform synchronization immediately after the connection is established (sync_type defines the direction of replication); default value is false

sync_period : 120000,

Period in millisecond to automatically synchronize data (sync_type defines the direction of replication); default value is 0 (disable automatic replication)

compression_level The global level of compression for all clients (unless specified differently in the connections section): 0 = no compression; 1 = best speed, 9 - best compression. Default value is 0

connections : [ {...}, ],

Array of connectors:

 
    # Type of connection, 'listen' (default) or 'connect'
    type : "listen",

    # IoT runtiime enabled at startup (default is true)
    enabled : false,
     
    # Network address to connect or listen on
    address : "127.0.0.1:5000",
     
    # Timeout for connect() operation in milliseconds 
    # (has sense only for 'type' == "connect").
    # Default value is 2000 (2 seconds)
    connect_timeout : 2000,
     
    # Interval between connect() operations in milliseconds 
    # (has sense only for 'type' == "connect").
    # Default value is 60*1000 (1 minute)
    connect_interval : 10000,
     
    # Use local (UNIX) socket domain. Default value 'false'
    local_sockets : false,
     
    # SSL parameters. If this section is not specified, 
    # SSL is not used for the connection. To inherit the
    #   global ssl_params settings, leave the ssl_params
     # section empty.
    ssl_params : {...  }
    # Override global compression level for this connection
    compression_level : 0,