Package com.rabbitmq.client.QueueingConsumer

Examples of com.rabbitmq.client.QueueingConsumer.Delivery


      Channel channel = q.getChannel();

      try {

        while (timeLimit == 0 || now < startTime + timeLimit) {
          Delivery delivery;
          if (timeLimit == 0) {
            delivery = q.nextDelivery();
          } else {
            delivery = q.nextDelivery(startTime + timeLimit - now);
            if (delivery == null)
              break;
          }
          totalMsgCount++;

          DataInputStream d = new DataInputStream(new ByteArrayInputStream(delivery.getBody()));
          long msgNano = d.readLong();
          long nano = System.nanoTime();

          Envelope envelope = delivery.getEnvelope();

          if (!autoAck) {
            channel.basicAck(envelope.getDeliveryTag(), false);
          }
View Full Code Here


    noTxChannel.basicPublish("", "test.queue", null, "foo".getBytes());

    QueueingConsumer callback = new QueueingConsumer(txChannel);
    txChannel.basicConsume("test.queue", callback);
    Delivery next = callback.nextDelivery(1000L);
    assertNotNull(next);
    txChannel.basicReject(next.getEnvelope().getDeliveryTag(), true);
    txChannel.txRollback();

    GetResponse get = noTxChannel.basicGet("test.queue", true);
    assertNotNull(get);
View Full Code Here

    noTxChannel.basicPublish("", "test.queue", null, "one".getBytes());
    noTxChannel.basicPublish("", "test.queue", null, "two".getBytes());

    QueueingConsumer callback = new QueueingConsumer(txChannel);
    txChannel.basicConsume("test.queue", callback);
    Delivery next = callback.nextDelivery(1000L);
    assertNotNull(next);
    txChannel.basicReject(next.getEnvelope().getDeliveryTag(), true);
    txChannel.txRollback();

    GetResponse get = noTxChannel.basicGet("test.queue", true);
    assertNotNull(get);
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.QueueingConsumer.Delivery

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.