Github user mtaylor commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1629#discussion_r148502940
--- Diff:
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
---
@@ -1978,6 +1980,36 @@ public void testConnectorServiceManagement() throws
Exception {
Assert.assertEquals("myconn2",
managementControl.getConnectorServices()[0]);
}
+ @Test
+ public void testCloseConsumer() throws Exception {
+ SimpleString address = RandomUtil.randomSimpleString();
+ SimpleString name = RandomUtil.randomSimpleString();
+ boolean durable = true;
+
+ ActiveMQServerControl serverControl = createManagementControl();
+
+
checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name,
RoutingType.ANYCAST));
+ serverControl.createAddress(address.toString(), "ANYCAST");
+ serverControl.createQueue(address.toString(), "ANYCAST",
name.toString(), null, durable, -1, false, false);
+
+ ServerLocator receiveLocator = createInVMNonHALocator();
+ ClientSessionFactory receiveCsf =
createSessionFactory(receiveLocator);
+ ClientSession receiveClientSession = receiveCsf.createSession(true,
false, false);
+ final ClientConsumer consumer =
receiveClientSession.createConsumer(name);
+ final ClientProducer producer =
receiveClientSession.createProducer(name);
+
+ ServerSession ss = server.getSessions().iterator().next();
+ ServerConsumer sc = ss.getServerConsumers().iterator().next();
+
+ producer.send(receiveClientSession.createMessage(true));
+ consumer.receive(1000);
+
+ Assert.assertFalse(consumer.isClosed());
+
serverControl.closeConsumerWithID(((ClientSessionImpl)receiveClientSession).getName(),
Long.toString(sc.sequentialID()));
+ Wait.waitFor(() -> consumer.isClosed(), 1000, 100);
+ Assert.assertTrue(consumer.isClosed());
+ }
+
protected void scaleDown(ScaleDownHandler handler) throws Exception {
--- End diff --
Nice test. I realise this is outside the scope of this JIRA, but some more
testing around other protocols would be useful, in addition it'd be good to
test that this works with the Artemis JMS Client since it uses CORE under the
covers. We can do these in follow up commits.
+1 overall. Merging
---