Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/GMLC-TDC/HELICS/llms.txt

Use this file to discover all available pages before exploring further.

The HELICS broker is the coordination hub of every federation. It routes publications to subscribers, dispatches messages between endpoints, and manages the global time advancement algorithm that keeps all federates synchronized. You can run a broker as a standalone process using the helics_broker executable, manage multiple brokers dynamically with helics_broker_server, or embed one directly in your C++ application using the BrokerApp class.

Starting a broker

The most common invocation passes -f (the minimum number of federates expected) and a log level:
helics_broker -f 2 --loglevel=warning
The broker waits until the specified number of federates have connected before allowing the federation to advance into the execution phase. You can also specify a name and core type:
helics_broker -f 4 --name=main_broker --type=zmq --loglevel=debug
Open an interactive terminal alongside the broker by passing term as the first argument:
helics_broker term -f 2 --loglevel=warning
Enable automatic restart on completion (with a 3-second window to cancel with Ctrl-C):
helics_broker --autorestart -f 2 --loglevel=warning

Command-line flags

General options

FlagShortDescription
--name-nName to assign to this broker
--type-tCore type: zmq (default), ipc, tcp, udp, mpi, test
--rootDeclare this broker as a root broker
--identifierAlternative way to set the broker name
FlagDescription
--federates / --minfedMinimum number of federates that must connect before execution starts
--minbrokersMinimum number of sub-brokers or cores that must connect
--maxiterMaximum number of allowed time iterations
--tickHeartbeat interval in milliseconds (also accepts 10s, 45ms). After two missed ticks secondary actions are taken
--timeoutTime to wait for a broker connection (milliseconds or time string)
--error_timeoutTime to wait before disconnecting after an error
FlagDescription
--loglevelGlobal log level (higher = more output; -1 disables logging entirely)
--consoleloglevelLog level for console output only
--fileloglevelLog level for file output only
--logfilePath to the log output file
--dumplogCapture all messages and dump a complete log on termination
FlagDescription
--terminate_on_errorHalt the entire co-simulation if any federate reports an error

Network options (ZMQ, TCP, UDP)

FlagDescription
--interfaceLocal network interface for receiving connections
--broker / -bAddress or identifier of a parent broker to connect to
--broker_addressFull network address of the parent broker
--brokernameName of the parent broker
--portPort number for the broker
--brokerportPort for the broker priority port
--localportPort for the local receive port
--portstartStarting port for automatic port assignment
--localBind to the loopback interface (default)
--ipv4Bind to external IPv4 addresses
--ipv6Bind to external IPv6 addresses
--externalBind to all external interfaces
FlagDescription
--queuelocNamed location of the shared memory queue
--brokerinitInitialization string for the parent broker

Terminal mode

When started with term, the broker opens an interactive prompt where you can inspect and control it while it runs:
helics_broker term -f 2
Available terminal commands:
helics>>help
`quit`          -> close the terminal and wait for broker to finish
`terminate`     -> force the broker to stop
`terminate*`    -> force the broker to stop and exit the application
`help`, `?`     -> show this help
`restart`       -> restart a completed broker
`status`        -> display current broker status
`info`          -> display broker name, connection state, and address
`force restart` -> force terminate and immediately restart the broker
`query` <queryString>         -> query the broker
`query` <target> <queryString> -> query a specific target

Status output

The status command shows the live count of connected brokers, federates, and handles:
helics>>status
Broker (643204-ibrVd-14EWH-unKfh-hExUP) is connected and is accepting new federates
{"brokers":0,
"federates":0,
"handles":0}

Info output

The info command shows the broker’s name, connection status, and bound address:
helics>>info
Broker (643204-ibrVd-14EWH-unKfh-hExUP) is connected and is accepting new federates
address=tcp://127.0.0.1:23404

Broker queries

The query command (in terminal mode or via the API) returns runtime information about the federation. For example, query counts returns the same JSON object as status:
helics>>query counts
Other useful query strings include federates, brokers, publications, subscriptions, endpoints, interfaces, and version. Full documentation of all available queries is in the Queries reference.

BrokerServer: dynamic broker creation

helics_broker_server is a coordinator that creates new brokers on demand rather than requiring you to start one per federation manually. It is currently experimental and works only with ZMQ.
helics_broker_server --zmq
You can specify how long the server should run:
helics_broker_server --duration "2 hours"
Open a terminal control window alongside the server:
helics_broker_server term

BrokerServer command-line flags

FlagShortDescription
--zmq-zStart a ZMQ broker server
--zmqssStart a ZMQ single-socket broker server
--tcp-tStart a TCP broker server
--udp-uStart a UDP broker server
--mpiStart an MPI broker server
--durationHow long the server should run (default: 30 minutes)
--quietSuppress most printed output

BrokerServer terminal commands

helics-broker-server>>help
`quit`       -> close the terminal and wait for broker server to finish
`terminate`  -> force the broker server to stop
`terminate*` -> force the broker server and all existing brokers to terminate
`help`, `?`  -> show this help
The broker server is marked experimental as of HELICS 2.2 and only supports ZMQ. Support for TCP, TCPSS, UDP, and MPI is planned for future releases.

Programmatic broker: BrokerApp C++ class

You can embed a broker directly in your C++ application using the BrokerApp class rather than launching a separate process. This is convenient in unit tests or when writing a single-process orchestrator:
#include <helics/apps/BrokerApp.hpp>

// Create a ZMQ broker expecting 3 federates
helics::apps::BrokerApp broker("zmq", "-f 3 --name=embedded_broker");

// ... run your federation ...

broker.forceTerminate();
The BrokerApp constructor accepts the same arguments as helics_broker. The object keeps the broker alive for its lifetime and cleans up on destruction.
Use BrokerApp in test suites to avoid port conflicts and process management overhead. Each test can create its own broker with a unique name and a different port range via --portstart.

Build docs developers (and LLMs) love