[ https://issues.apache.org/jira/browse/ARTEMIS-4259?focusedWorklogId=864154&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-864154 ]
ASF GitHub Bot logged work on ARTEMIS-4259: ------------------------------------------- Author: ASF GitHub Bot Created on: 07/Jun/23 13:14 Start Date: 07/Jun/23 13:14 Worklog Time Spent: 10m Work Description: clebertsuconic commented on code in PR #4502: URL: https://github.com/apache/activemq-artemis/pull/4502#discussion_r1221576164 ########## tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSFQQNConsumerTest.java: ########## @@ -0,0 +1,209 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.tests.integration.jms.multiprotocol; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.jms.Topic; + +import org.apache.activemq.artemis.api.core.RoutingType; +import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; +import org.apache.activemq.artemis.tests.util.CFUtil; +import org.apache.activemq.artemis.utils.CompositeAddress; +import org.apache.activemq.artemis.utils.RandomUtil; +import org.apache.activemq.artemis.utils.Wait; +import org.junit.Assert; +import org.junit.Test; + +public class JMSFQQNConsumerTest extends MultiprotocolJMSClientTestSupport { + + @Test + public void testFQQNTopicConsumerWithSelectorAMQP() throws Exception { + testFQQNTopicConsumerWithSelector("AMQP", true); + } + + @Test + public void testFQQNTopicConsumerWithSelectorOpenWire() throws Exception { + testFQQNTopicConsumerWithSelector("OPENWIRE", false); + } + + @Test + public void testFQQNTopicConsumerWithSelectorCore() throws Exception { + testFQQNTopicConsumerWithSelector("CORE", true); + } + + private void testFQQNTopicConsumerWithSelector(String protocol, boolean validateFilterChange) throws Exception { + ConnectionFactory factory = CFUtil.createConnectionFactory(protocol, "tcp://localhost:5672"); + final String queue = "queue"; + final String address = "address"; + final String filter = "prop='value'"; + try (Connection c = factory.createConnection()) { + c.start(); + Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE); + Topic t = s.createTopic(CompositeAddress.toFullyQualified(address, queue)); + MessageConsumer mc = s.createConsumer(t, filter); + Wait.assertTrue(() -> server.locateQueue(queue) != null, 2000, 100); Review Comment: This one is just to make sure the queue exists. The creation of the queue is asynchronous, so it should keep trying with the Wait doing a loop for 2 seconds, waiting 100 milliseconds in between. Issue Time Tracking ------------------- Worklog Id: (was: 864154) Time Spent: 2h 20m (was: 2h 10m) > JMS consumer + FQQN + selector not working > ------------------------------------------ > > Key: ARTEMIS-4259 > URL: https://issues.apache.org/jira/browse/ARTEMIS-4259 > Project: ActiveMQ Artemis > Issue Type: Bug > Reporter: Justin Bertram > Assignee: Justin Bertram > Priority: Major > Time Spent: 2h 20m > Remaining Estimate: 0h > > The CORE protocol does not honor consumers with a filter when used on FQQN > topics. > Steps to reproduce: > Start a consumer using CLI: > {noformat} > ./artemis consumer --url tcp://localhost:61616 --destination > topic://topic1::topic1.queue1 --protocol=core --message-count 1 --filter > "foo='bar'" --verbose{noformat} > Send a message without the filter string: > {noformat} > ./artemis producer --url tcp://localhost:61616 --destination > topic://topic1::topic1.queue1 --protocol=core --message-count 1 --message > "some text"{noformat} > You can observe the CORE client consuming the message which does not contain > the filter String: > {noformat} > Connection brokerURL = tcp://localhost:61616 > Consumer:: filter = foo='bar' > Consumer ActiveMQTopic[topic1::topic1.queue1], thread=0 wait until 1 messages > are consumed > Consumer ActiveMQTopic[topic1::topic1.queue1], thread=0 Received some text > JMS Message ID:ID:a00cbea3-dda7-11ed-9c2d-b42e99ea6f5c > Received text sized at 9 > Consumer ActiveMQTopic[topic1::topic1.queue1], thread=0 Consumed: 1 messages > Consumer ActiveMQTopic[topic1::topic1.queue1], thread=0 Elapsed time in > second : 8 s > Consumer ActiveMQTopic[topic1::topic1.queue1], thread=0 Elapsed time in milli > second : 8140 milli seconds > Consumer ActiveMQTopic[topic1::topic1.queue1], thread=0 Consumed: 1 messages > Consumer ActiveMQTopic[topic1::topic1.queue1], thread=0 Consumer thread > finished{noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)