[
https://issues.apache.org/jira/browse/ARTEMIS-1486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16235681#comment-16235681
]
ASF GitHub Bot commented on ARTEMIS-1486:
-----------------------------------------
Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1629#discussion_r148523746
--- 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);
--- End diff --
With my pull request on Wait, you would been able to do
Wait.assertTrue(consumer::isClosed)
> Core client should be notified if consumer is closed on broker side
> -------------------------------------------------------------------
>
> Key: ARTEMIS-1486
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1486
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Stanislav Knot
> Priority: Major
>
> If consumer is closed on broker using e.g. Hawtio console, client connected
> as that consumer (representation of broker resource) should be notified about
> that fact and react to that. It doesn't seem to react. If consumer is closed,
> as a result of not being notified, client hangs in the air and cannot receive
> messages.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)