Package com.rabbitmq.client

Examples of com.rabbitmq.client.QueueingConsumer


    public void testQueueAutoDelete() throws IOException {
        String name = "tempqueue";
        channel.queueDeclare(name, false, false, true, null);
        // now it's there
        verifyQueue(name, false, false, true, null);
        QueueingConsumer consumer = new QueueingConsumer(channel);
        String consumerTag = channel.basicConsume(name, consumer);
        channel.basicCancel(consumerTag);
        // now it's not .. we hope
        try {
            verifyQueueExists(name);
View Full Code Here


    public void testExclusiveNotAutoDelete() throws IOException {
        String name = "exclusivequeue";
        channel.queueDeclare(name, false, true, false, null);
        // now it's there
        verifyQueue(name, false, true, false, null);
        QueueingConsumer consumer = new QueueingConsumer(channel);
        String consumerTag = channel.basicConsume(name, consumer);
        channel.basicCancel(consumerTag);
        // and still there, because exclusive no longer implies autodelete
        verifyQueueExists(name);
    }
View Full Code Here

        throws IOException, InterruptedException, ShutdownSignalException
    {
        openConnection();
        open();
        injectMessage();
        QueueingConsumer c = new QueueingConsumer(channel);
        channel.basicConsume(Q, c);
        c.nextDelivery();
        close();
        Thread.sleep(GRATUITOUS_DELAY);
        open();
        assertNotNull(getMessage());
        close();
View Full Code Here

        channel.queueDelete(Q);
        channel.queueDeclare(Q, false, false, false, null);
        for (int i = 0; i < MESSAGE_COUNT; i++) {
            channel.basicPublish("", Q, null, "in flight message".getBytes());
        }
        QueueingConsumer c = new QueueingConsumer(channel);
        channel.basicConsume(Q, c);
        c.nextDelivery();
        close();
        open();
        for (int i = 0; i < MESSAGE_COUNT; i++) {
            GetResponse r = channel.basicGet(Q, true);
            assertNotNull("only got " + i + " out of " + MESSAGE_COUNT +
View Full Code Here

        }
        fail("Active queue declaration of an exclusive queue from another connection should fail");
    }

    public void testQueueExclusiveForConsume() throws Exception {
        QueueingConsumer c = new QueueingConsumer(channel);
        try {
            channel.basicConsume(q, c);
        } catch (IOException ioe) {
            checkShutdownSignal(AMQP.RESOURCE_LOCKED, ioe);
            return;
View Full Code Here

                for(int i = 0; i < MESSAGE_COUNT; i++) {
                    channel.basicPublish("", queueName,
                                         MessageProperties.BASIC, MESSAGE);
                }

                QueueingConsumer consumer = new QueueingConsumer(channel);
                channel.basicConsume(queueName, true, consumer);

                long publishTime = System.nanoTime() - start;

                start = System.nanoTime();

                for(int i = 0; i < MESSAGE_COUNT; i++){
                    consumer.nextDelivery();
                }

                long consumeTime = System.nanoTime() - start;

                double publishRate =
View Full Code Here

    }

    public void testMessageLimitUnlimited()
        throws IOException
    {
        QueueingConsumer c = new QueueingConsumer(channel);
        configure(c, 0, 1, 2);
        drain(c, 2);
    }
View Full Code Here

    }

    public void testNoAckNoAlterLimit()
        throws IOException
    {
        QueueingConsumer c = new QueueingConsumer(channel);
        declareBindConsume(channel, c, true);
        channel.basicQos(1);
        fill(2);
        drain(c, 2);
    }
View Full Code Here

    public void testNoAckObeysLimit()
        throws IOException
    {
        channel.basicQos(1);
        QueueingConsumer c1 = new QueueingConsumer(channel);
        declareBindConsume(channel, c1, false);
        fill(1);
        QueueingConsumer c2 = new QueueingConsumer(channel);
        declareBindConsume(channel, c2, true);
        fill(1);
        try {
            Delivery d = c2.nextDelivery(1000);
            assertNull(d);
        } catch (InterruptedException ie) {
            fail("interrupted");
        }
        Queue<Delivery> d = drain(c1, 1);
View Full Code Here

    }

    public void testFairness()
        throws IOException
    {
        QueueingConsumer c = new QueueingConsumer(channel);
        final int queueCount = 3;
        final int messageCount = 100;
        List<String> queues = configure(c, 1, queueCount, messageCount);

        for (int i = 0; i < messageCount - 1; i++) {
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.QueueingConsumer

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.