Package org.apache.activemq.broker.region

Examples of org.apache.activemq.broker.region.Queue$OrderedNonTransactionWorkTx


        waitFor(new Condition() {
            public boolean isSatisified() throws Exception {
                return !regionBroker.getDestinations(ActiveMQDestination.transform(dest)).isEmpty();
            }
        });
        Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();
        assertEquals("consumer count on " + broker.getBrokerName() + " matches for q: " + internalQueue, count, internalQueue.getConsumers().size());     
    }
View Full Code Here


        assertEquals("consumer count on " + broker.getBrokerName() + " matches for q: " + internalQueue, count, internalQueue.getConsumers().size());     
    }

    private void verifyConsumePriority(BrokerService broker, byte expectedPriority, Destination dest) throws Exception {
        RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
        Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();
        for (Subscription consumer : internalQueue.getConsumers()) {
            assertEquals("consumer on " + broker.getBrokerName() + " matches priority: " + internalQueue, expectedPriority, consumer.getConsumerInfo().getPriority());     
        }
    }
View Full Code Here

  }

  private void assertQueueLength(int len) throws Exception, IOException {
    Set<Destination> destinations = bs.getBroker().getDestinations(
        new ActiveMQQueue(QUEUE_NAME));
    Queue queue = (Queue) destinations.iterator().next();
    assertEquals(len, queue.getMessageStore().getMessageCount());
  }
View Full Code Here

    public void purgeQueue(ActiveMQDestination destination) throws Exception {
        Set destinations = getManagedBroker().getQueueRegion().getDestinations(destination);
        for (Iterator i = destinations.iterator(); i.hasNext();) {
            Destination dest = (Destination) i.next();
            if (dest instanceof Queue) {
                Queue regionQueue = (Queue) dest;
                regionQueue.purge();
            }
        }
    }
View Full Code Here

    } finally {
      conn.close();
    }

    // Verify that half of the messages can be removed by selector.
    Queue queue = (Queue) broker.getRegionBroker().getDestinations(
        destination).iterator().next();

    Assert.assertEquals(NUM_MESSAGES / 2, queue
        .removeMatchingMessages(MESSAGE_ID + " < " + NUM_MESSAGES / 2));

    // Verify that the remainder of the messages can be removed by empty
    // selector.
    Assert.assertEquals(NUM_MESSAGES - NUM_MESSAGES / 2, queue
        .removeMatchingMessages(""));
  }
View Full Code Here

    /**
     * Moves a message back to its original destination
     */
    public boolean retryMessage(String messageId) throws Exception {
        Queue queue = (Queue) destination;
        QueueMessageReference ref = queue.getMessage(messageId);
        Message rc = ref.getMessage();
        if (rc != null) {
            ActiveMQDestination originalDestination = rc.getOriginalDestination();
            if (originalDestination != null) {
                ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
                return queue.moveMessageTo(context, ref, originalDestination);
            }
            else {
                throw new JMSException("No original destination for message: "+ messageId);
            }
        }
View Full Code Here

            throw new JMSException("Could not find message: "+ messageId);
        }
    }

    public int cursorSize() {
        Queue queue = (Queue) destination;
        if (queue.getMessages() != null){
            return queue.getMessages().size();
        }
        return 0;
    }
View Full Code Here

        return 0;
    }


    public boolean doesCursorHaveMessagesBuffered() {
       Queue queue = (Queue) destination;
       if (queue.getMessages() != null){
           return queue.getMessages().hasMessagesBufferedToDeliver();
       }
       return false;

    }
View Full Code Here

    }


    public boolean doesCursorHaveSpace() {
        Queue queue = (Queue) destination;
        if (queue.getMessages() != null){
            return queue.getMessages().hasSpace();
        }
        return false;
    }
View Full Code Here

        return false;
    }


    public long getCursorMemoryUsage() {
        Queue queue = (Queue) destination;
        if (queue.getMessages() != null &&  queue.getMessages().getSystemUsage() != null){
            return queue.getMessages().getSystemUsage().getMemoryUsage().getUsage();
        }
        return 0;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.region.Queue$OrderedNonTransactionWorkTx

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.