createBroker method

Future<MessageBroker?> createBroker()

The broker @Consumes handlers subscribe to.

Returns null by default, which is what makes messaging opt-in: an app with no broker registers no consumers, even if handlers are annotated. Connecting is async, so this is a method rather than a getter.

The returned broker is owned by the framework from here on — it is drained and closed as part of shutdown.

Implementation

Future<MessageBroker?> createBroker() async => null;