0

I'm customizing the embedded ActiveMQ Artemis server using the code below.

@Override
public void customize(org.apache.activemq.artemis.core.config.Configuration configuration)

It works fine, and I figured out I can access later on like this ->

Queue queue =  embeddedActiveMQ.getActiveMQServer().locateQueue("queue");

QueueControl queueControl = new QueueControlImpl(queue,
                queue.getAddress().toString(),embeddedActiveMQ.getActiveMQServer(),embeddedActiveMQ.getActiveMQServer().getStorageManager()              ,embeddedActiveMQ.getActiveMQServer().getSecurityStore(),embeddedActiveMQ.getActiveMQServer().getAddressSettingsRepository());

queueControl.browse();

Is there a problem doing like this?

I'm trying to write a custom endpoint to handle the queue management instead of using the classical package with Jolokia.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
Juan Marques
  • 3
  • 1
  • 3

1 Answers1

1

Technically speaking there isn't really a problem doing this, but there may be better ways of doing what you want. For example, to get a QueueControl instance you can do something like this:

QueueControl queueControl = embeddedActiveMQ.getActiveMQServer().getManagementService().getResource(ResourceNames.QUEUE + "queue");

This will get the QueueControl which was already created for the queue rather than creating a new one from scratch.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43