Skip to content

Commit 16907fe

Browse files
author
Emile Joubert
committed
Merged bug21845 into default
2 parents a9dbea3 + 4e4ab76 commit 16907fe

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

test/src/com/rabbitmq/client/test/functional/FunctionalTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public static TestSuite suite() {
4343
suite.addTestSuite(Routing.class);
4444
suite.addTestSuite(BindingLifecycle.class);
4545
suite.addTestSuite(Recover.class);
46+
suite.addTestSuite(TransactionalRecover.class);
4647
suite.addTestSuite(Transactions.class);
4748
suite.addTestSuite(PersistentTransactions.class);
4849
suite.addTestSuite(RequeueOnConnectionClose.class);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.rabbitmq.client.test.functional;
2+
3+
import com.rabbitmq.client.GetResponse;
4+
import com.rabbitmq.client.test.BrokerTestCase;
5+
6+
import java.io.IOException;
7+
8+
/**
9+
* Test basic.recover on a transactional channel
10+
*/
11+
public class TransactionalRecover extends BrokerTestCase {
12+
byte[] body = "Hello!".getBytes();
13+
14+
public void createResources() throws IOException {
15+
}
16+
17+
public void testRedeliverAckedUncommitted() throws IOException, InterruptedException {
18+
String queue = channel.queueDeclare().getQueue();
19+
channel.txSelect();
20+
channel.basicPublish("", queue, null, body);
21+
channel.txCommit();
22+
GetResponse response = channel.basicGet(queue, false);
23+
24+
// Ack the message but do not commit the channel. The message should
25+
// not get redelivered (see
26+
// https://bugzilla.rabbitmq.com/show_bug.cgi?id=21845#c3)
27+
28+
channel.basicAck(response.getEnvelope().getDeliveryTag(), false);
29+
channel.basicRecover(true);
30+
31+
assertNull("Acked uncommitted message redelivered",
32+
channel.basicGet(queue, true));
33+
}
34+
}

0 commit comments

Comments
 (0)