[SOLVED] MQTT Broker not found after update to 2.4

We are developping an openHAB binding based on the MQTT binding.
In our binding we can set the name of the broker, and the binding takes care of finding the broker and subscribing to the relevant topics.

Before the update of openHAB, we have manually defined mqtt brokers using config files, and found the matching broker iterating over

mqttService.getAllBrokerConnections()

Now, after the update, things are different. As far as we understood, brokers can now be defined directly using the PaperUI (nice feature :+1:). Also, an embedded MQTT broker is available (which is apparently not visible for other applications except openHAB).
After updating our code to the new API of the MQTT transport binding and defining brokers only via the PaperUI, the only broker found is the embedded one. In the PaperUI, the broker shows up online, and a quick test using a openHAB rule was successful.
We still iterate using the same method (which now returns a map, rather than a list).

So, questions are:
Is the way, we define brokers, correct? And, how can we find our brokers within the binding code?

Probably @David_Graeff can best answer this?

You now iterate over Things from the ThingRegistry. Filter for things by the respective thingUID (mqtt:broker afair).

Use the configuration values to get the host and port of the broker. Or get the thing handler for the Thing and call getConnection().

Send from a phone.

I’m pretty sure this is incorrect. It wouldn’t be that much use if it could only be used for OH to talk to itself. It should start up on port 1883 like any other broker. It doesn’t have many security features enabled at this time though so beware if you choose to use it that you don’t expose it.

Yes, you’re right. The port gets exposed. Thanks for the correction.

Yes, I can do this. It is either mqtt:systemBroker or mqtt:broker for the embedded and any other broker, respectively.

Okay, I got it, maybe. Having the thing representing the broker, I’m able to use your suggested second way:

ThingHandler handler = thing.getHandler();
if (handler instanceof AbstractBrokerHandler) {
    AbstractBrokerHandler abh = (AbstractBrokerHandler) handler;
    myBrokerAdded(abh.getConnection());
}

Is that the right way to do it?
Getting the configuration values for host and port, I could not come up with a solution.

It is actually quite hard to get to know all those things (e.g., that there is a ThingRegistry). Is there any developer documentation?