[
https://issues.apache.org/jira/browse/ARTEMIS-4231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737401#comment-17737401
]
Justin Bertram commented on ARTEMIS-4231:
-----------------------------------------
You can enable the management console via an embedded instance of Jetty managed
by the broker using the following code:
{code:java}
String pathToArtemis = "/path/to/artemis";
EmbeddedActiveMQ server = new EmbeddedActiveMQ();
server.setMbeanServer(ManagementFactory.getPlatformMBeanServer());
server.setConfiguration(config.setJMXManagementEnabled(true));
server.start();
WebServerComponent webServerComponent = new WebServerComponent();
WebServerDTO webServerDTO = new WebServerDTO();
webServerDTO.path = "web";
BindingDTO bindingDTO = new BindingDTO();
bindingDTO.uri = "http://localhost:8161";
AppDTO branding = new AppDTO();
branding.name = "branding";
branding.url = "activemq-branding";
branding.war = "activemq-branding.war";
AppDTO plugin = new AppDTO();
plugin.name = "plugin";
plugin.url = "artemis-plugin";
plugin.war = "artemis-plugin.war";
AppDTO console = new AppDTO();
console.name = "console";
console.url = "console";
console.war = "console.war";
bindingDTO.addApp(branding);
bindingDTO.addApp(plugin);
bindingDTO.addApp(console);
webServerDTO.addBinding(bindingDTO);
webServerComponent.configure(webServerDTO, pathToArtemis, pathToArtemis);
server.getActiveMQServer().addExternalComponent(webServerComponent, true);{code}
> Configure EmbeddedWebServer programmatically
> --------------------------------------------
>
> Key: ARTEMIS-4231
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4231
> Project: ActiveMQ Artemis
> Issue Type: Wish
> Components: Configuration
> Affects Versions: 2.28.0
> Reporter: Raymond
> Priority: Major
>
> I would like to use the management console within my embedded broker.
> 1) I have Spring Boot application (using Jetty as a web server).
> 2) In the application I use an embedded broker.
> I use [this
> documentation|https://activemq.apache.org/components/artemis/documentation/latest/embedding-activemq.html].
> The code:
> {code:java}
> EmbeddedActiveMQ server = new EmbeddedActiveMQ();
> server.setConfiguration(config);
> server.start();{code}
> Now as a second step, I like to enable the management console. I checked
> [this
> documentation|https://activemq.apache.org/components/artemis/documentation/latest/web-server.html]
> page. There it says that the embedded webserver can be managed through
> various operations on the {{ActiveMQServerControl}}. The configuration is
> done through "{{etc/bootstrap.xml}}". I of course don't have any
> configuration files. Is there a way to programmatically run and configure the
> management console together with my Spring Boot application?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)