Package com.rabbitmq.client

Examples of com.rabbitmq.client.QueueingConsumer.nextDelivery()


                                    now,
                                    delta));
                startTime = System.currentTimeMillis();
            }
            chan.basicPublish("", q, props, body);
            QueueingConsumer.Delivery d = consumer.nextDelivery();
            chan.basicAck(d.getEnvelope().getDeliveryTag(), false);
        }
        System.out.println();

        trace("Switching QOS to unlimited");
View Full Code Here


        trace("Switching QOS to unlimited");
        chan.basicQos(0);

        trace("Draining backlog");
        for (int i = 0; i < backlogSize; i++) {
            QueueingConsumer.Delivery d = consumer.nextDelivery();
            chan.basicAck(d.getEnvelope().getDeliveryTag(), false);
        }

        redeclare(q, chan);
View Full Code Here

    for(int i = 0; i < THREADS; i++){
      new Thread(){
        @Override public void run(){
          try {
            while(true){
                c.nextDelivery();
            }
          } catch (ShutdownSignalException sig) {
              count.decrementAndGet();
          } catch (Exception e) {
            throw new RuntimeException(e);
View Full Code Here

            ch1.queueBind(queueName, exchange, "#");

            QueueingConsumer consumer = new QueueingConsumer(ch1);
            ch1.basicConsume(queueName, true, consumer);
            while (true) {
                QueueingConsumer.Delivery delivery = consumer.nextDelivery();
                String routingKey = delivery.getEnvelope().getRoutingKey();
                String contentType = delivery.getProperties().getContentType();
                System.out.println("Content-type: " + contentType);
                System.out.println("Routing-key: " + routingKey);
                System.out.println("Body:");
View Full Code Here

      }

            QueueingConsumer consumer = new QueueingConsumer(ch);
            ch.basicConsume(queueName, consumer);
            while (true) {
                QueueingConsumer.Delivery delivery = consumer.nextDelivery();
    Map<String, Object> headers = delivery.getProperties().getHeaders();
    byte[] body = delivery.getBody();
    Object headerFilenameO = headers.get("filename");
    String headerFilename =
        (headerFilenameO == null)
View Full Code Here

        String consumerTag = channel.basicConsume(Q, true, c);
        // publishes after an alarm should not go through
        basicPublishVolatile(Q);
        // the publish is async, so this is racy. This also tests we don't die
        // by heartbeat (3x heartbeat interval + epsilon)
        assertNull(c.nextDelivery(3100));
        // once the alarm has cleared the publishes should go through
        clearResourceAlarm("memory");
        assertNotNull(c.nextDelivery(3100));
        // everything should be back to normal
        channel.basicCancel(consumerTag);
View Full Code Here

        // the publish is async, so this is racy. This also tests we don't die
        // by heartbeat (3x heartbeat interval + epsilon)
        assertNull(c.nextDelivery(3100));
        // once the alarm has cleared the publishes should go through
        clearResourceAlarm("memory");
        assertNotNull(c.nextDelivery(3100));
        // everything should be back to normal
        channel.basicCancel(consumerTag);
        basicPublishVolatile(Q);
        assertNotNull(basicGet(Q));
    }
View Full Code Here

        String consumerTag = channel.basicConsume(Q, true, c);

        setResourceAlarm("memory");
        basicPublishVolatile(Q);

        assertNull(c.nextDelivery(100));
        setResourceAlarm("disk");
        assertNull(c.nextDelivery(100));
        clearResourceAlarm("memory");
        assertNull(c.nextDelivery(100));
        clearResourceAlarm("disk");
View Full Code Here

        setResourceAlarm("memory");
        basicPublishVolatile(Q);

        assertNull(c.nextDelivery(100));
        setResourceAlarm("disk");
        assertNull(c.nextDelivery(100));
        clearResourceAlarm("memory");
        assertNull(c.nextDelivery(100));
        clearResourceAlarm("disk");
        assertNotNull(c.nextDelivery(3100));
View Full Code Here

        assertNull(c.nextDelivery(100));
        setResourceAlarm("disk");
        assertNull(c.nextDelivery(100));
        clearResourceAlarm("memory");
        assertNull(c.nextDelivery(100));
        clearResourceAlarm("disk");
        assertNotNull(c.nextDelivery(3100));

        channel.basicCancel(consumerTag);
        basicPublishVolatile(Q);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.