Search in sources :

Example 1 with Redistributor

use of org.apache.activemq.artemis.core.server.cluster.impl.Redistributor in project activemq-artemis by apache.

the class QueueImpl method cancelRedistributor.

@Override
public synchronized void cancelRedistributor() throws Exception {
    if (redistributor != null) {
        redistributor.stop();
        Redistributor redistributorToRemove = redistributor;
        redistributor = null;
        removeConsumer(redistributorToRemove);
    }
    clearRedistributorFuture();
}
Also used : Redistributor(org.apache.activemq.artemis.core.server.cluster.impl.Redistributor)

Example 2 with Redistributor

use of org.apache.activemq.artemis.core.server.cluster.impl.Redistributor in project activemq-artemis by apache.

the class QueueImpl method internalAddRedistributor.

private void internalAddRedistributor(final ArtemisExecutor executor) {
    // create the redistributor only once if there are no local consumers
    if (consumerSet.isEmpty() && redistributor == null) {
        if (logger.isTraceEnabled()) {
            logger.trace("QueueImpl::Adding redistributor on queue " + this.toString());
        }
        redistributor = new Redistributor(this, storageManager, postOffice, executor, QueueImpl.REDISTRIBUTOR_BATCH_SIZE);
        consumerList.add(new ConsumerHolder(redistributor));
        consumersChanged = true;
        redistributor.start();
        deliverAsync();
    }
}
Also used : Redistributor(org.apache.activemq.artemis.core.server.cluster.impl.Redistributor)

Example 3 with Redistributor

use of org.apache.activemq.artemis.core.server.cluster.impl.Redistributor in project activemq-artemis by apache.

the class QueueImpl method hasMatchingConsumer.

@Override
public boolean hasMatchingConsumer(final Message message) {
    for (ConsumerHolder holder : consumerList) {
        Consumer consumer = holder.consumer;
        if (consumer instanceof Redistributor) {
            continue;
        }
        Filter filter1 = consumer.getFilter();
        if (filter1 == null) {
            return true;
        } else {
            if (filter1.match(message)) {
                return true;
            }
        }
    }
    return false;
}
Also used : Consumer(org.apache.activemq.artemis.core.server.Consumer) Filter(org.apache.activemq.artemis.core.filter.Filter) Redistributor(org.apache.activemq.artemis.core.server.cluster.impl.Redistributor)

Aggregations

Redistributor (org.apache.activemq.artemis.core.server.cluster.impl.Redistributor)3 Filter (org.apache.activemq.artemis.core.filter.Filter)1 Consumer (org.apache.activemq.artemis.core.server.Consumer)1