Credits:The XMQ web site is provided by Linotex.The XMQ and SPTK Windows installers are created with Advanced Installer free Open-Source license.
There were 0 unique visitors to this page

Extensions

Extensions

An extension is a shared library the broker loads into its own process. It can watch what the broker does, decide who may connect, or name what a client may publish and subscribe to. Extensions are how XMQ gains an identity source such as a directory without the broker growing a second user table, and how accepted messages or log records reach an external system.

Each extension declares which of five capabilities it implements. A library that declares none is loaded, started and stopped, and otherwise never called.

CapabilityWhat the broker asks it
observerTo receive broker events: connections, subscriptions, publications and the like, as they happen.
authenticatorWhether a connecting client may connect. Asked on the authentication threads, in configuration order, and stopping at the first allow or deny.
authorizerWhich group a client belongs to, and what that group may publish or subscribe to. The answer is cached by the broker per group and topic.
message tapTo copy accepted messages matching filters the extension asked for.
log tapTo copy the broker's own log records, from a level the extension asked for.

Five extensions ship with this release, and each has its own page in theExtensions menu: the accounts database (User Database Authentication), theLDAP Authentication directory authenticator,JWT Authentication,HTTP Authentication, and theWebhook that posts messages and log records to an endpoint. The first four decide who may connect; the webhook moves data out.

Where extensions are configured

Extensions are described in xmq_extensions.d/*.conf beside the broker's configuration file, or in a single xmq_extensions.conf. Each entry names the library, whether the broker must have it, and the extension's own settings:

{
  "extensions": [{
    "name": "ldap",
    "library": "/opt/xmq/lib/xmq-extensions/libxmq_ldap.so",
    "enabled": true,
    "required": true,
    "settings": {
      "uri": "ldaps://ldap.example.org:636"
    }
  }]
}

The name must match the name the library reports, or the broker refuses to load it: a configuration that names one extension while the broker runs another is worse than a configuration that fails. The file an entry came from is shown on theExtensions page, which is also where the settings are edited once the broker is running.

The page lists every extension installed beside the configured ones, including those no entry mentions. An unmentioned library appears stopped, with the version and description it reports about itself, and is switched on with Enable; that writes a fragment of its own, xmq_extensions.d/90-<name>.conf, which from then on is where its entry lives. Nothing is started by merely being installed. The accounts database is the exception: it is never offered as an optional switch, because a broker either configures it or does not run with accounts at all.

Order matters for authenticators. They are asked in configuration order and the first allow or deny is final; an extension that does not recognise a client abstains, and the broker's own accounts answer last. A directory must therefore be listed before the accounts database when local accounts are the fallback rather than the authority.

Required means the broker will not serve MQTT without it — the configuration interface still starts, so the mistake can be corrected there. Use it for whatever decides who may connect; leave an optional tap or connector not required.

Settings and secrets

An extension declares its settings — name, label, type, default and the values it accepts — so the interface can draw a form and refuse a bad value before it reaches the extension. A setting marked secret is masked on screen and kept out of the log.

The settings are stored in the configuration files, not in the accounts database, so they belong to the node. A cluster therefore needs the same extension configuration on every node, and a credential such as a directory service password is repeated there. Restrict those files to the broker's account: an extension configuration with a password in it is as sensitive as the password itself.

Saving settings on the Extensions page asks the running extension to apply them immediately, without restarting MQTT. An extension that cannot apply a change says so and keeps what it had, rather than running half-configured.

What an extension cannot do

An extension runs inside the broker: a crash in its code is a crash of the broker, and a call that blocks holds one of the broker's threads. Its library must be built against this broker's extension ABI; a library built for a newer ABI is refused at load time rather than called into. Extensions cannot add listeners, change the storage engine, or serve the configuration interface.

Keeping authorisation in the broker is deliberate. An extension may say who a client is and which groups it belongs to; what those groups may publish or subscribe to stays in Topic Permissions, so the policy is in one place and can be read on one screen.