dxlclient.broker module

Contains the Broker class, which represents a DXL message broker.

class dxlclient.broker.Broker(host_name, unique_id=None, ip_address=None, port=8883)

Bases: dxlclient._BaseObject

The class Broker represents a DXL message broker.

Instances of this class are created for the purpose of connecting to the DXL fabric.

There are several ways to create Broker instances:

Constructor parameters:

Parameters:
  • host_name -- The host name or IP address of the broker (required)
  • unique_id -- A unique identifier for the broker, used to identify the broker in log messages, etc. (optional)
  • ip_address -- A valid IP address for the broker. This allows for both the host name and IP address to be used when connecting to the broker (optional).
  • port -- The port of the broker (defaults to 8883)
host_name

The host name or IP address of the broker

ip_address

A valid IP address for the broker. This allows for both the host name and IP address to be used when connecting to the broker

static parse(broker_url)

Returns a broker instance corresponding to the specified broker URL of the form:

[ssl://]<hostname>[:port]

Valid URLs include:

  • ssl://mybroker:8883
  • ssl://mybroker
  • mybroker:8883
  • mybroker

If the port is omitted it will be defaulted to 8883.

Parameters:broker_url -- A valid broker URL
Returns:A broker corresponding to the specified broker URL
port

The port of the broker

to_string()

Returns a string representation of the broker for the purposes of logging, etc.

unique_id

A unique identifier for the broker, used to identify the broker in log messages, etc.