ARTEMIS-1013 Queue deliver after AMQP msg release
This commit is contained in:
parent
a353da0caf
commit
543dd4c9e3
|
@ -326,7 +326,8 @@ public class AMQPSessionCallback implements SessionCallback {
|
||||||
public void cancel(Object brokerConsumer, Message message, boolean updateCounts) throws Exception {
|
public void cancel(Object brokerConsumer, Message message, boolean updateCounts) throws Exception {
|
||||||
recoverContext();
|
recoverContext();
|
||||||
try {
|
try {
|
||||||
((ServerConsumer) brokerConsumer).individualCancel(message.getMessageID(), updateCounts);
|
((ServerConsumer) brokerConsumer).individualCancel(message.getMessageID(), updateCounts);;
|
||||||
|
((ServerConsumer) brokerConsumer).getQueue().forceDelivery();
|
||||||
} finally {
|
} finally {
|
||||||
resetContext();
|
resetContext();
|
||||||
}
|
}
|
||||||
|
@ -560,7 +561,6 @@ public class AMQPSessionCallback implements SessionCallback {
|
||||||
Transaction tx = protonSPI.getTransaction(txid);
|
Transaction tx = protonSPI.getTransaction(txid);
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
protonSPI.removeTransaction(txid);
|
protonSPI.removeTransaction(txid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleString getMatchingQueue(SimpleString address, RoutingType routingType) throws Exception {
|
public SimpleString getMatchingQueue(SimpleString address, RoutingType routingType) throws Exception {
|
||||||
|
|
|
@ -44,6 +44,10 @@ public class AmqpReceiverDispositionTest extends AmqpClientTestSupport {
|
||||||
receiver1.flow(1);
|
receiver1.flow(1);
|
||||||
|
|
||||||
AmqpMessage message = receiver1.receive(5, TimeUnit.SECONDS);
|
AmqpMessage message = receiver1.receive(5, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
AmqpReceiver receiver2 = session.createReceiver(getTestName());
|
||||||
|
|
||||||
|
|
||||||
assertNotNull("did not receive message first time", message);
|
assertNotNull("did not receive message first time", message);
|
||||||
assertEquals("MessageID:0", message.getMessageId());
|
assertEquals("MessageID:0", message.getMessageId());
|
||||||
|
|
||||||
|
@ -51,12 +55,11 @@ public class AmqpReceiverDispositionTest extends AmqpClientTestSupport {
|
||||||
assertNotNull(protonMessage);
|
assertNotNull(protonMessage);
|
||||||
assertEquals("Unexpected initial value for AMQP delivery-count", 0, protonMessage.getDeliveryCount());
|
assertEquals("Unexpected initial value for AMQP delivery-count", 0, protonMessage.getDeliveryCount());
|
||||||
|
|
||||||
|
receiver2.flow(1);
|
||||||
message.release();
|
message.release();
|
||||||
|
|
||||||
// Read the message again and validate its state
|
|
||||||
|
|
||||||
AmqpReceiver receiver2 = session.createReceiver(getTestName());
|
// Read the message again and validate its state
|
||||||
receiver2.flow(1);
|
|
||||||
message = receiver2.receive(10, TimeUnit.SECONDS);
|
message = receiver2.receive(10, TimeUnit.SECONDS);
|
||||||
assertNotNull("did not receive message again", message);
|
assertNotNull("did not receive message again", message);
|
||||||
assertEquals("MessageID:0", message.getMessageId());
|
assertEquals("MessageID:0", message.getMessageId());
|
||||||
|
|
|
@ -110,7 +110,6 @@ public class ProtonTest extends ProtonTestBase {
|
||||||
private static final String amqpConnectionUri = "amqp://localhost:5672";
|
private static final String amqpConnectionUri = "amqp://localhost:5672";
|
||||||
|
|
||||||
private static final String tcpAmqpConnectionUri = "tcp://localhost:5672";
|
private static final String tcpAmqpConnectionUri = "tcp://localhost:5672";
|
||||||
|
|
||||||
private static final String brokerName = "my-broker";
|
private static final String brokerName = "my-broker";
|
||||||
|
|
||||||
private static final long maxSizeBytes = 1 * 1024 * 1024;
|
private static final long maxSizeBytes = 1 * 1024 * 1024;
|
||||||
|
@ -1855,4 +1854,32 @@ public class ProtonTest extends ProtonTestBase {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReleaseDisposition() throws Exception {
|
||||||
|
AmqpClient client = new AmqpClient(new URI(tcpAmqpConnectionUri), userName, password);
|
||||||
|
AmqpConnection connection = client.connect();
|
||||||
|
try {
|
||||||
|
AmqpSession session = connection.createSession();
|
||||||
|
|
||||||
|
AmqpSender sender = session.createSender(address);
|
||||||
|
AmqpMessage message = new AmqpMessage();
|
||||||
|
message.setText("Test-Message");
|
||||||
|
sender.send(message);
|
||||||
|
|
||||||
|
AmqpReceiver receiver = session.createReceiver(address);
|
||||||
|
receiver.flow(10);
|
||||||
|
|
||||||
|
AmqpMessage m1 = receiver.receive(5, TimeUnit.SECONDS);
|
||||||
|
assertNotNull(m1);
|
||||||
|
m1.release();
|
||||||
|
|
||||||
|
//receiver.flow(10);
|
||||||
|
AmqpMessage m2 = receiver.receive(5, TimeUnit.SECONDS);
|
||||||
|
assertNotNull(m2);
|
||||||
|
m2.accept();
|
||||||
|
} finally {
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue