Package com.rabbitmq.client

Examples of com.rabbitmq.client.GetResponse


    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


    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

    when(mockConnectionFactory.newConnection((ExecutorService) null)).thenReturn(mockConnection);
    when(mockConnection.isOpen()).thenReturn(true);
    when(mockConnection.createChannel()).thenReturn(mockChannel1).thenReturn(mockChannel2);

    when(mockChannel1.basicGet("foo", false)).thenReturn(new GetResponse(null, null, null, 1));
    when(mockChannel2.basicGet("bar", false)).thenReturn(new GetResponse(null, null, null, 1));
    when(mockChannel1.isOpen()).thenReturn(true);
    when(mockChannel2.isOpen()).thenReturn(true);

    CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
    ccf.setChannelCacheSize(2);
View Full Code Here

  public Message receive(final String queueName) {
    return execute(new ChannelCallback<Message>() {

      @Override
      public Message doInRabbit(Channel channel) throws IOException {
        GetResponse response = channel.basicGet(queueName, !isChannelTransacted());
        // Response can be null is the case that there is no message on the queue.
        if (response != null) {
          long deliveryTag = response.getEnvelope().getDeliveryTag();
          if (isChannelLocallyTransacted(channel)) {
            channel.basicAck(deliveryTag, false);
            channel.txCommit();
          }
          else if (isChannelTransacted()) {
View Full Code Here

      @Override
      public Boolean doInRabbit(Channel channel) throws Exception {
        boolean channelTransacted = RabbitTemplate.this.isChannelTransacted();

        GetResponse response = channel.basicGet(queueName, !channelTransacted);
        // Response can be null in the case that there is no message on the queue.
        if (response != null) {
          long deliveryTag = response.getEnvelope().getDeliveryTag();
          boolean channelLocallyTransacted = RabbitTemplate.this.isChannelLocallyTransacted(channel);

          if (channelLocallyTransacted) {
            channel.basicAck(deliveryTag, false);
          }
View Full Code Here

      @Override
      public String doInRabbit(Channel channel) throws Exception {
        // We need noAck=false here for the message to be expicitly
        // acked
        GetResponse response = channel.basicGet(ROUTE, false);
        MessageProperties messageProps = messagePropertiesConverter.toMessageProperties(
            response.getProps(), response.getEnvelope(), "UTF-8");
        // Explicit ack
        channel.basicAck(response.getEnvelope().getDeliveryTag(), false);
        return (String) new SimpleMessageConverter().fromMessage(new Message(response.getBody(), messageProps));
      }
    });
    assertEquals("message", result);
    result = (String) template.receiveAndConvert(ROUTE);
    assertEquals(null, result);
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.GetResponse

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.