rabbitmq-tests/src/test/java/com/datastax/oss/starlight/rabbitmqtests/javaclient/functional/BindingLifecycle.java
@SuppressWarnings("deprecation")
  @Test
  @Ignore("Need to implement queue purge first")
  public void unackedPurge() throws IOException {
    Binding binding = setupExchangeBindings(false);
    channel.basicPublish(binding.x, binding.k, null, payload);

    GetResponse response = TestUtils.basicGet(channel, 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 = TestUtils.basicGet(channel, binding.q, true);
    assertNull("The response SHOULD BE null", response);

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

    // If we recover then purge the message should go away
    channel.queuePurge(binding.q);
    response = TestUtils.basicGet(channel, binding.q, true);
    assertNull("The response SHOULD BE null", response);

    deleteExchangeAndQueue(binding);
  }
/**
   * See bug 21854: "When Queue.Purge is called, sent-but-unacknowledged messages are no longer
   * purged, even if the channel they were sent down is not (Tx-)transacted."
   */
See bug 21854: "When Queue.Purge is called, sent-but-unacknowledged messages are no longer
purged, even if the channel they were sent down is not (Tx-)transacted."
See bug 21854 : " When Queue . Purge is called sent - but - unacknowledged messages are no longer purged even if the channel they were sent down is not ( Tx - ) transacted . "
@SuppressWarnings("deprecation")
  @Test
  @Ignore("Need to implement queue purge first")
  public void unackedPurge() throws IOException {
    Binding binding = setupExchangeBindings(false);
    channel.basicPublish(binding.x, binding.k, null, payload);
    GetResponse response = TestUtils.basicGet(channel, binding.q, false);
    assertFalse(response.getEnvelope().isRedeliver());
    assertNotNull("The response SHOULD NOT BE null", response);
    channel.queuePurge(binding.q);
    response = TestUtils.basicGet(channel, binding.q, true);
    assertNull("The response SHOULD BE null", response);
    channel.basicRecover();
    response = TestUtils.basicGet(channel, binding.q, false);
    channel.basicRecover();
    assertTrue(response.getEnvelope().isRedeliver());
    assertNotNull("The response SHOULD NOT BE null", response);
    channel.queuePurge(binding.q);
    response = TestUtils.basicGet(channel, binding.q, true);
    assertNull("The response SHOULD BE null", response);
    deleteExchangeAndQueue(binding);
  }
@ SuppressWarnings ( "deprecation" ) @ Test @ Ignore ( "Need to implement queue purge first" ) public void unackedPurge ( ) throws IOException { Binding binding = setupExchangeBindings ( false ) ; channel . basicPublish ( binding . x , binding . k , null , payload ) ; GetResponse response = TestUtils . basicGet ( channel , binding . q , false ) ; assertFalse ( response . getEnvelope ( ) . isRedeliver ( ) ) ; assertNotNull ( "The response SHOULD NOT BE null" , response ) ; channel . queuePurge ( binding . q ) ; response = TestUtils . basicGet ( channel , binding . q , true ) ; assertNull ( "The response SHOULD BE null" , response ) ; channel . basicRecover ( ) ; response = TestUtils . basicGet ( channel , binding . q , false ) ; channel . basicRecover ( ) ; assertTrue ( response . getEnvelope ( ) . isRedeliver ( ) ) ; assertNotNull ( "The response SHOULD NOT BE null" , response ) ; channel . queuePurge ( binding . q ) ; response = TestUtils . basicGet ( channel , binding . q , true ) ; assertNull ( "The response SHOULD BE null" , response ) ; deleteExchangeAndQueue ( binding ) ; }
See bug 21854: "When Queue.Purge is called, sent-but-unacknowledged messages are no longer
 purged, even if the channel they were sent down is not (Tx-)transacted."
See bug 21854 : " When Queue . Purge is called sent - but - unacknowledged messages are no longer purged even if the channel they were sent down is not ( Tx - ) transacted . "
// If we purge the queue the unacked message should still be there on // recover. // If we recover then purge the message should go away