Search in sources :

Example 26 with Bindings

use of org.apache.activemq.artemis.core.postoffice.Bindings in project activemq-artemis by apache.

the class MessageRedistributionTest method getRemoteQueueBinding.

private RemoteQueueBinding getRemoteQueueBinding(ActiveMQServer server) throws Exception {
    ActiveMQServer remoteServer = server;
    Bindings bindings = remoteServer.getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress"));
    Collection<Binding> bindingSet = bindings.getBindings();
    return getRemoteQueueBinding(bindingSet);
}
Also used : Binding(org.apache.activemq.artemis.core.postoffice.Binding) RemoteQueueBinding(org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Bindings(org.apache.activemq.artemis.core.postoffice.Bindings)

Example 27 with Bindings

use of org.apache.activemq.artemis.core.postoffice.Bindings in project activemq-artemis by apache.

the class PostOfficeImpl method listQueuesForAddress.

@Override
public List<Queue> listQueuesForAddress(SimpleString address) throws Exception {
    Bindings bindingsForAddress = getBindingsForAddress(address);
    List<Queue> queues = new ArrayList<>();
    for (Binding b : bindingsForAddress.getBindings()) {
        if (b instanceof QueueBinding) {
            Queue q = ((QueueBinding) b).getQueue();
            queues.add(q);
        }
    }
    return queues;
}
Also used : Binding(org.apache.activemq.artemis.core.postoffice.Binding) QueueBinding(org.apache.activemq.artemis.core.postoffice.QueueBinding) QueueBinding(org.apache.activemq.artemis.core.postoffice.QueueBinding) ArrayList(java.util.ArrayList) Bindings(org.apache.activemq.artemis.core.postoffice.Bindings) Queue(org.apache.activemq.artemis.core.server.Queue)

Example 28 with Bindings

use of org.apache.activemq.artemis.core.postoffice.Bindings in project activemq-artemis by apache.

the class WildcardAddressManager method getBindingsForRoutingAddress.

@Override
public Bindings getBindingsForRoutingAddress(final SimpleString address) throws Exception {
    Bindings bindings = super.getBindingsForRoutingAddress(address);
    // this should only happen if we're routing to an address that has no mappings when we're running checkAllowable
    if (bindings == null && !wildCardAddresses.isEmpty()) {
        Address add = addAndUpdateAddressMap(address);
        if (!add.containsWildCard()) {
            for (Address destAdd : add.getLinkedAddresses()) {
                Bindings b = super.getBindingsForRoutingAddress(destAdd.getAddress());
                if (b != null) {
                    Collection<Binding> theBindings = b.getBindings();
                    for (Binding theBinding : theBindings) {
                        super.addMappingInternal(address, theBinding);
                    }
                    super.getBindingsForRoutingAddress(address).setMessageLoadBalancingType(b.getMessageLoadBalancingType());
                }
            }
        }
        bindings = super.getBindingsForRoutingAddress(address);
    }
    return bindings;
}
Also used : Binding(org.apache.activemq.artemis.core.postoffice.Binding) Address(org.apache.activemq.artemis.core.postoffice.Address) Bindings(org.apache.activemq.artemis.core.postoffice.Bindings)

Example 29 with Bindings

use of org.apache.activemq.artemis.core.postoffice.Bindings in project activemq-artemis by apache.

the class ActiveMQServerControlImpl method listBindingsForAddress.

@Override
public String listBindingsForAddress(String address) throws Exception {
    checkStarted();
    clearIO();
    try {
        final Bindings bindings = server.getPostOffice().getBindingsForAddress(new SimpleString(address));
        return bindings.getBindings().stream().map(Binding::toManagementString).collect(Collectors.joining(","));
    } finally {
        blockOnIO();
    }
}
Also used : SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Bindings(org.apache.activemq.artemis.core.postoffice.Bindings)

Example 30 with Bindings

use of org.apache.activemq.artemis.core.postoffice.Bindings in project activemq-artemis by apache.

the class AddressControlImpl method getBindingNames.

@Override
public String[] getBindingNames() throws Exception {
    clearIO();
    try {
        Bindings bindings = postOffice.getBindingsForAddress(addressInfo.getName());
        String[] bindingNames = new String[bindings.getBindings().size()];
        int i = 0;
        for (Binding binding : bindings.getBindings()) {
            bindingNames[i++] = binding.getUniqueName().toString();
        }
        return bindingNames;
    } catch (Throwable t) {
        throw new IllegalStateException(t.getMessage());
    } finally {
        blockOnIO();
    }
}
Also used : Binding(org.apache.activemq.artemis.core.postoffice.Binding) QueueBinding(org.apache.activemq.artemis.core.postoffice.QueueBinding) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Bindings(org.apache.activemq.artemis.core.postoffice.Bindings)

Aggregations

Bindings (org.apache.activemq.artemis.core.postoffice.Bindings)35 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)24 Binding (org.apache.activemq.artemis.core.postoffice.Binding)22 QueueBinding (org.apache.activemq.artemis.core.postoffice.QueueBinding)15 LocalQueueBinding (org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding)12 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)7 Test (org.junit.Test)7 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)6 Queue (org.apache.activemq.artemis.core.server.Queue)6 RemoteQueueBinding (org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding)6 ArrayList (java.util.ArrayList)5 PostOffice (org.apache.activemq.artemis.core.postoffice.PostOffice)5 Connection (javax.jms.Connection)4 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)4 Address (org.apache.activemq.artemis.core.postoffice.Address)4 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)4 IOException (java.io.IOException)3 PrintWriter (java.io.PrintWriter)3 StringWriter (java.io.StringWriter)3 MessageConsumer (javax.jms.MessageConsumer)3