Posts by ncolter

    By default, the the python client will attempt to reconnect by looping connection attempts to brokers on the broker list.


    The reconnect loop will only attempt to connect to a broker after a set amount of time dictated by a backoff timer, to avoid spamming the network with connection attempts in the case of a large number of clients losing connection to their brokers at once.


    The settings to control reconnect behavior can be seen in the OpenDXL Python Client Documentation for the dxlclient.client_config module, or below:


    dxlclient.client_config 

    reconnect_back_off_multiplier Multiples the current reconnect delay by this value on subsequent connect retries. For example, a current delay of 3 seconds with a multiplier of 2 would result in the next retry attempt being in 6 seconds. Defaults to 2
    reconnect_delay The initial delay between retry attempts in seconds. The delay increases (“backs off”) as subsequent connection attempts are made. Defaults to 1 second

    reconnect_delay_max
    The maximum delay between connection retry attempts in seconds Defaults to 60 seconds (1 minute)
    reconnect_delay_random Get the randomness delay percentage (between 0.0 and 1.0). The default value is 0.25
    reconnect_when_disconnected Whether the client will continuously attempt to reconnect to the fabric if it becomes disconnected Defaults to True





    A high volume of repeated connect/disconnects across a large number of clients will have more of a performance impact than simply leaving them connected. DXL clients should not connect and then disconnect every time they send a message.


    As a general practice, it is more efficient to leave a DXL client connected for the full duration of the application's runtime. While a DXL client is connected, it will periodically contact the broker to insure that it is still connected, with negligible impact on the performance of the brokers on the DXL fabric.

    If you have multiple brokers in your DXL fabric, the standard method is to provide a list of them to the OpenDXL Python Client through the config file before runtime. To see an example of what a config file with multiple brokers looks like, view the GitHub documentation for the OpenDXL Python Client Samples Configuration.

    In your Python client code, load the configuration from the file before you connect to a broker. See the example below (where "yourfile.config" would be the location+name of your config file):

    Python
    1. # Create DXL configuration from file
    2. config = DxlClientConfig.create_dxl_config_from_file("yourfile.config")
    3. # Create the client
    4. with DxlClient(config) as client:
    5. # Connect to the fabric
    6. client.connect()


    It is also possible to manually create your DxlClientConfig object and set the list of Broker objects in your code instead of through a config file:

    Python
    1. # Create the client configuration
    2. config = DxlClientConfig(
    3. broker_ca_bundle="c:\\certs\\brokercerts.crt",
    4. cert_file="c:\\certs\\client.crt",
    5. private_key="c:\\certs\\client.key",
    6. brokers=[Broker.parse("ssl://192.168.189.12")])


    For more information on Broker.parse(), see the dxlclient.broker module documentation on Github.

    Tutorials present the opportunity for OpenDXL users and integrators to provide guidance and drive best practices for community projects. The Tutorials forum section is used to provide a single location for community-written Tutorials, and is open to submissions from all registered users. To submit a new Tutorial, simply go to the Tutorials Forum, create a new thread, and input the tutorial as the first post in the thread.


    Here is a simple list of requirements for submitted tutorials:


    Writing Style

    • An introductory description of the Tutorial in the beginning of the documentation, including what the tutorial is intended to guide the reader through accomplishing or understanding
    • Correct grammar, spelling, and punctuation
    • Clear and concise information for each step in the tutorial

    Dependencies & Prerequisite Knowledge

    • Description of any environment prerequisites or other dependencies, and links to where the reader can find them
    • Description of any prior knowledge that is recommended before starting the tutorial, and where the reader can get started finding that information if needed

    Images

    • Images should be clear and legible (no obvious scaling issues or other quality loss)

    Once a tutorial has been submitted and approved, it is made public for the OpenDXL community in the Tutorials section section of the forum.