Search in sources :

Example 1 with AddressView

use of org.apache.activemq.artemis.core.management.impl.view.AddressView in project activemq-artemis by apache.

the class ActiveMQServerControlImpl method listAddresses.

@Override
public String listAddresses(String options, int page, int pageSize) throws Exception {
    checkStarted();
    clearIO();
    try {
        final Set<SimpleString> addresses = server.getPostOffice().getAddresses();
        List<AddressInfo> addressInfo = new ArrayList<>();
        for (SimpleString address : addresses) {
            AddressInfo info = server.getPostOffice().getAddressInfo(address);
            // ignore if no longer available
            if (info != null) {
                addressInfo.add(info);
            }
        }
        AddressView view = new AddressView(server);
        view.setCollection(addressInfo);
        view.setOptions(options);
        return view.getResultsAsJson(page, pageSize);
    } finally {
        blockOnIO();
    }
}
Also used : ArrayList(java.util.ArrayList) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) AddressView(org.apache.activemq.artemis.core.management.impl.view.AddressView) AddressInfo(org.apache.activemq.artemis.core.server.impl.AddressInfo)

Aggregations

ArrayList (java.util.ArrayList)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 AddressView (org.apache.activemq.artemis.core.management.impl.view.AddressView)1 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)1