Package com.rabbitmq.client

Examples of com.rabbitmq.client.GetResponse


  protected void restart() throws IOException {
  }

  protected void sendRoutable(Binding binding) throws IOException {
    channel.basicPublish(binding.x, binding.k, null, payload);
    GetResponse response = channel.basicGet(binding.q, true);
    assertNotNull("The response should not be null", response);
  }
View Full Code Here


    assertNotNull("The response should not be null", response);
  }

  protected void sendUnroutable(Binding binding) throws IOException {
    channel.basicPublish(binding.x, binding.k, null, payload);
    GetResponse response = channel.basicGet(binding.q, true);
    assertNull("The response SHOULD BE null", response);
  }
View Full Code Here

        channel.basicReject(d.getEnvelope().getDeliveryTag(), true);
        assertNull(c.nextDelivery(100));
    }

    protected void expectBodyAndRemainingMessages(String body, int messagesLeft) throws IOException {
        GetResponse response = channel.basicGet(TTL_QUEUE_NAME, false);
        assertNotNull(response);
        assertEquals(body, new String(response.getBody()));
        assertEquals(messagesLeft, response.getMessageCount());
    }
View Full Code Here

    }

    protected abstract AMQP.Queue.DeclareOk declareQueue(String name, Object ttlValue) throws IOException;

    protected String get() throws IOException {
        GetResponse response = basicGet(TTL_QUEUE_NAME);
        return response == null ? null : new String(response.getBody());
    }
View Full Code Here

        channel.basicPublish(binding.x, binding.k, null, payload);

        // Purge the queue, and test that we don't recieve a message
        channel.queuePurge(binding.q);

        GetResponse response = channel.basicGet(binding.q, true);
        assertNull("The response SHOULD BE null", response);

        deleteExchangeAndQueue(binding);
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    public void testUnackedPurge() throws IOException {
        Binding binding = setupExchangeBindings(false);
        channel.basicPublish(binding.x, binding.k, null, payload);

        GetResponse response = channel.basicGet(binding.q, false);
        assertFalse(response.getEnvelope().isRedeliver());
        assertNotNull("The response SHOULD NOT BE null", response);

        // If we purge the queue the unacked message should still be there on
        // recover.
        channel.queuePurge(binding.q);
        response = channel.basicGet(binding.q, true);
        assertNull("The response SHOULD BE null", response);

        channel.basicRecoverAsync(true);
        response = channel.basicGet(binding.q, false);
        assertTrue(response.getEnvelope().isRedeliver());
        assertNotNull("The response SHOULD NOT BE null", response);

        // If we recover then purge the message should go away
        channel.basicRecoverAsync(true);
        channel.queuePurge(binding.q);
View Full Code Here

    public void testSSL() throws IOException
    {
        channel.queueDeclare("Bug19356Test", false, true, true, null);
        channel.basicPublish("", "Bug19356Test", null, "SSL".getBytes());

        GetResponse chResponse = channel.basicGet("Bug19356Test", false);
        assertNotNull(chResponse);

        byte[] body = chResponse.getBody();
        assertEquals("SSL", new String(body));
    }
View Full Code Here

        int howMuch = 2*FRAME_MAX;
        basicPublishVolatile(new byte[howMuch], queueName);
        /* Receive everything that was sent out. */
        while (howMuch > 0) {
            try {
                GetResponse response = channel.basicGet(queueName, false);
                howMuch -= response.getBody().length;
            } catch (Exception e) {
                e.printStackTrace();
                fail("Exception in basicGet loop: " + e);
            }
        }
View Full Code Here

    }

    public void checkReceivedStompDelivery(String expectedRKSuffix)
            throws IOException
    {
        GetResponse r = basicGet(q1);
        assertNotNull(r);
        assertTrue("Delivery has correct routing key", r.getEnvelope().getRoutingKey().endsWith(expectedRKSuffix));
        assertEquals("rk1", r.getProps().getHeaders().get("destination").toString());
        assertEquals("rk2", r.getProps().getHeaders().get("rk").toString());
        assertEquals("value1", r.getProps().getHeaders().get("header1").toString());
        assertEquals("value2", r.getProps().getHeaders().get("header2").toString());
        assertEquals("Hello STOMP", new String(r.getBody(), "utf-8"));
    }
View Full Code Here

    }
   
    public void testUdpSendAmqpReceive() throws IOException {
        String message = "Hello from UDP";
        sendString(message, pOutRaw);
        GetResponse r = basicGet(q1);
        assertNotNull(r);
        assertEquals(message, new String(r.getBody(), "utf-8"));
    }
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.