Package org.apache.activemq.broker.region

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


        }

        // Access the implementation of the test queue and move the last message
        // to another queue. Verify that the move occurred within the limits of
        // the test.
        Queue queue = (Queue) broker.getRegionBroker().getDestinationMap().get(
                destination);

        ConnectionContext context = new ConnectionContext(
                new NonCachedMessageEvaluationContext());
        context.setBroker(broker.getBroker());
        context.getMessageEvaluationContext().setDestination(destination);

        long startTimeMillis = System.currentTimeMillis();
        Assert.assertEquals(1, queue
                .moveMatchingMessagesTo(context, "id=" + (QUEUE_SIZE - 1),
                        createDestination(MOVE_TO_DESTINATION_NAME)));

        long durationMillis = System.currentTimeMillis() - startTimeMillis;
View Full Code Here


        }

        // Access the implementation of the test queue and move the last message
        // to another queue. Verify that the move occurred within the limits of
        // the test.
        Queue queue = (Queue) broker.getRegionBroker().getDestinationMap().get(
                destination);

        ConnectionContext context = new ConnectionContext(
                new NonCachedMessageEvaluationContext());
        context.setBroker(broker.getBroker());
        context.getMessageEvaluationContext().setDestination(destination);

        long startTimeMillis = System.currentTimeMillis();
        Assert.assertEquals(1,
            queue.copyMatchingMessagesTo(context, "id=" + (QUEUE_SIZE - 1), createDestination(MOVE_TO_DESTINATION_NAME)));

        long durationMillis = System.currentTimeMillis() - startTimeMillis;

        LOG.info("It took " + durationMillis
                + "ms to copy the last message from a queue a " + QUEUE_SIZE
View Full Code Here

        }

        // Access the implementation of the test queue and move the last message
        // to another queue. Verify that the move occurred within the limits of
        // the test.
        Queue queue = (Queue) broker.getRegionBroker().getDestinationMap().get(
                destination);

        ConnectionContext context = new ConnectionContext(
                new NonCachedMessageEvaluationContext());
        context.setBroker(broker.getBroker());
        context.getMessageEvaluationContext().setDestination(destination);

        long startTimeMillis = System.currentTimeMillis();
        Assert.assertEquals(1,
            queue.removeMatchingMessages("id=" + (QUEUE_SIZE - 1)));

        long durationMillis = System.currentTimeMillis() - startTimeMillis;

        LOG.info("It took " + durationMillis
                + "ms to remove the last message from a queue a " + QUEUE_SIZE
View Full Code Here

            public void dispatchAsync(Command command) {
            }
        });

        final DestinationStatistics destinationStatistics = new DestinationStatistics();
        final Queue queue = new Queue(broker, destination,
                queueMessageStore, destinationStatistics, broker.getTaskRunnerFactory());

        final MockMemoryUsage usage = new MockMemoryUsage();

        queue.setOptimizedDispatch(true);
        queue.initialize();
        queue.start();
        queue.memoryUsage = usage;

        ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
        ProducerInfo producerInfo = new ProducerInfo();
        ProducerState producerState = new ProducerState(producerInfo);
        producerExchange.setProducerState(producerState);
        producerExchange.setConnectionContext(contextNotInTx);

        // populate the queue store, exceed memory limit so that cache is disabled
        for (int i = 0; i < count; i++) {
            Message message = getMessage(i);
            queue.send(producerExchange, message);
        }

        usage.setFull(false);

        try {
            queue.wakeup();
        } catch(Exception e) {
            LOG.error("Queue threw an unexpected exception: " + e.toString());
            fail("Should not throw an exception.");
        }
    }
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

        }
        return 0;
    }

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

TOP

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

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.