To stop and shut down an embedded broker, use the stop() and shutdown() methods of the broker instance. For example:
// Stop the embedded broker brokerInstance.stop(); // Shut down the embedded broker brokerInstance.shutdown();