Package com.rabbitmq.client

Examples of com.rabbitmq.client.DefaultConsumer


                        new byte[0]);
    }

    public void testIt() throws IOException, InterruptedException {

        final Consumer c = new DefaultConsumer(channel);

        //1. create lots of auto-delete queues, bind them to the
        //amq.fanout exchange, and set up a non-auto-ack consumer for
        //each.
        for (int i = 0; i < Q_COUNT; i++) {
View Full Code Here


    protected void setUp() throws IOException {
        super.setUp();
        channel.confirmSelect();
        channel.queueDeclare("confirm-test", true, true, false, null);
        channel.basicConsume("confirm-test", true,
                             new DefaultConsumer(channel));
        channel.queueDeclare("confirm-test-nondurable", false, true,
                             false, null);
        channel.basicConsume("confirm-test-nondurable", true,
                             new DefaultConsumer(channel));
        channel.queueDeclare("confirm-test-noconsumer", true,
                             true, false, null);
        channel.queueDeclare("confirm-test-2", true, true, false, null);
        channel.basicConsume("confirm-test-2", true,
                             new DefaultConsumer(channel));
        channel.queueBind("confirm-test", "amq.direct",
                          "confirm-multiple-queues");
        channel.queueBind("confirm-test-2", "amq.direct",
                          "confirm-multiple-queues");
    }
View Full Code Here

        /* wait confirms to go through the broker */
        Thread.sleep(1000);

        channel.basicConsume("confirm-test-noconsumer", true,
                             new DefaultConsumer(channel));

        channel.waitForConfirmsOrDie();
    }
View Full Code Here

        channel.basicRecover(true);

        Thread.sleep(1000);

        channel.basicConsume("confirm-test-noconsumer", true,
                             new DefaultConsumer(channel));

        channel.waitForConfirmsOrDie();
    }
View Full Code Here

                        new byte[0]);
    }

    public void testIt() throws IOException, InterruptedException {

        final Consumer c = new DefaultConsumer(channel);

        //1. create lots of auto-delete queues, bind them to the
        //amq.fanout exchange, and set up a non-auto-ack consumer for
        //each.
        for (int i = 0; i < Q_COUNT; i++) {
View Full Code Here

            ConnectionFactory factory = new ConnectionFactory();
            factory.setUri(uri);
            Connection connection = factory.newConnection();
            final Channel ch = connection.createChannel();
            ch.queueDeclare(SERVER_QUEUE, false, true, false, null);
            ch.basicConsume(SERVER_QUEUE, true, new DefaultConsumer(ch) {
                @Override
                public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                    String replyTo = properties.getReplyTo();
                    ch.basicPublish("", replyTo, MessageProperties.MINIMAL_BASIC, "Hello client!".getBytes());
                }
View Full Code Here

    Channel channel = connection.createChannel();
    channel.exchangeDeclare("x", "direct");
    channel.queueDeclare("q", false, false, false, null);
    channel.queueBind("q", "x", "k");

    channel.basicConsume("q", true, new DefaultConsumer(channel){
        @Override
        public void handleDelivery(String consumerTag,
                                   Envelope envelope,
                                   AMQP.BasicProperties properties,
                                   byte[] body) {
View Full Code Here

        declareQueue("queue2", "", "queue1", null, 0);

        channel.basicPublish("", "queue1", MessageProperties.BASIC, "".getBytes());
        final CountDownLatch latch = new CountDownLatch(10);
        channel.basicConsume("queue2", false,
            new DefaultConsumer(channel) {
                @Override
                public void handleDelivery(String consumerTag, Envelope envelope,
                                           AMQP.BasicProperties properties, byte[] body) throws IOException {
                    channel.basicReject(envelope.getDeliveryTag(), false);
                    latch.countDown();
View Full Code Here

    @Test
    public void testExclusiveByDefault() throws IOException {
        testSubject.setConnectionFactory(connectionFactory);

        testSubject.getConnectionFactory().createConnection().createChannel(true).basicConsume("test", new DefaultConsumer(channel));

        verify(channel, never()).basicConsume(isA(String.class), isA(Consumer.class));
        verify(channel, never()).basicConsume(isA(String.class), anyBoolean(), isA(Consumer.class));
        verify(channel, never()).basicConsume(isA(String.class), anyBoolean(), anyString(), isA(Consumer.class));
        verify(channel, never()).basicConsume(isA(String.class), anyBoolean(), anyString(), anyBoolean(), eq(false), anyMap(), isA(Consumer.class));
View Full Code Here

    @Test
    public void testNonExclusive() throws IOException {
        testSubject.setConnectionFactory(connectionFactory);
        testSubject.setExclusive(false);

        testSubject.getConnectionFactory().createConnection().createChannel(true).basicConsume("test", new DefaultConsumer(channel));

        verify(channel, never()).basicConsume(isA(String.class), anyBoolean(), anyString(), anyBoolean(), eq(true), anyMap(), isA(Consumer.class));
    }
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.DefaultConsumer

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.