BundleContext context = kernel.getBundleFor(kernel.getKernelName()).getBundleContext();
String clazz = "org.osgi.service.blueprint.container.BlueprintContainer";
String filter = "(osgi.blueprint.container.symbolicname=org.apache.geronimo.configs.activemq-broker-blueprint)";
ServiceReference[] references = context.getServiceReferences(clazz, filter);
for (ServiceReference reference: references) {
BlueprintContainer container = (BlueprintContainer) context.getService(reference);
@SuppressWarnings("unchecked")
Set<String> ids = (Set<String>) container.getComponentIds();
for (Object id: ids) {
Object object = container.getComponentInstance((String)id);
if (object instanceof BrokerService) {
BrokerService brokerService = (BrokerService) object;
String brokerName = brokerService.getBrokerName();
String brokerURI = brokerService.getMasterConnectorURI();
State state = brokerService.isStarted() ? State.RUNNING : State.STOPPED;