This commit is contained in:
Clebert Suconic 2017-02-10 09:55:01 -05:00
commit 152b929b5a
5 changed files with 37 additions and 2 deletions

View File

@ -159,7 +159,7 @@ public class Artemis {
withDefaultCommand(HelpAddress.class).withCommands(CreateAddress.class, DeleteAddress.class, UpdateAddress.class, ShowAddress.class); withDefaultCommand(HelpAddress.class).withCommands(CreateAddress.class, DeleteAddress.class, UpdateAddress.class, ShowAddress.class);
if (instance != null) { if (instance != null) {
builder.withGroup("data").withDescription("data tools group (print|exp|imp|exp|encode|decode|compact) (example ./artemis data print)"). builder.withGroup("data").withDescription("data tools group (print|imp|exp|encode|decode|compact) (example ./artemis data print)").
withDefaultCommand(HelpData.class).withCommands(PrintData.class, XmlDataExporter.class, XmlDataImporter.class, DecodeJournal.class, EncodeJournal.class, CompactJournal.class); withDefaultCommand(HelpData.class).withCommands(PrintData.class, XmlDataExporter.class, XmlDataImporter.class, DecodeJournal.class, EncodeJournal.class, CompactJournal.class);
builder.withGroup("user").withDescription("default file-based user management (add|rm|list|reset) (example ./artemis user list)"). builder.withGroup("user").withDescription("default file-based user management (add|rm|list|reset) (example ./artemis user list)").
withDefaultCommand(HelpUser.class).withCommands(ListUser.class, AddUser.class, RemoveUser.class, ResetUser.class); withDefaultCommand(HelpUser.class).withCommands(ListUser.class, AddUser.class, RemoveUser.class, ResetUser.class);

View File

@ -507,6 +507,11 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
} }
} }
} else if (remoteState instanceof Accepted) { } else if (remoteState instanceof Accepted) {
//this can happen in the twice ack mode, that is the receiver accepts and settles separately
//acking again would show an exception but would have no negative effect but best to handle anyway.
if (delivery.isSettled()) {
return;
}
// we have to individual ack as we can't guarantee we will get the delivery updates // we have to individual ack as we can't guarantee we will get the delivery updates
// (including acks) in order // (including acks) in order
// from dealer, a perf hit but a must // from dealer, a perf hit but a must

View File

@ -49,7 +49,7 @@ For a full list of data tools commands available use:
``` ```
NAME NAME
artemis data - data tools group artemis data - data tools group
(print|exp|imp|exp|encode|decode|compact) (example ./artemis data print) (print|imp|exp|encode|decode|compact) (example ./artemis data print)
SYNOPSIS SYNOPSIS
artemis data artemis data

View File

@ -627,4 +627,8 @@ public class AmqpMessage {
message.setProperties(new Properties()); message.setProperties(new Properties());
} }
} }
public void settle() {
delivery.settle();
}
} }

View File

@ -74,6 +74,32 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
connection.close(); connection.close();
} }
@Test(timeout = 60000)
public void testAcceptWithoutSettling() throws Exception {
AmqpClient client = createAmqpClient();
AmqpConnection connection = addConnection(client.connect());
AmqpSession session = connection.createSession();
AmqpReceiver receiver = session.createReceiver(getTestName());
sendMessages(getTestName(), 10);
for (int i = 0; i < 10; i++) {
receiver.flow(1);
AmqpMessage receive = receiver.receive();
receive.accept(false);
receive.settle();
}
receiver.close();
connection.close();
Queue queue = getProxyToQueue(getTestName());
assertNotNull(queue);
assertEquals(0, queue.getMessageCount());
}
@Test(timeout = 60000) @Test(timeout = 60000)
public void testCreateQueueReceiverWithJMSSelector() throws Exception { public void testCreateQueueReceiverWithJMSSelector() throws Exception {
AmqpClient client = createAmqpClient(); AmqpClient client = createAmqpClient();