ARTEMIS-4188 auto-create + MDB using selector on queue

This commit is contained in:
Justin Bertram 2023-03-02 15:14:14 -06:00 committed by clebertsuconic
parent de7920d68a
commit 6874556f7c
2 changed files with 29 additions and 1 deletions

View File

@ -173,7 +173,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
} }
} else { } else {
tempQueueName = activation.getAddress(); tempQueueName = activation.getAddress();
AutoCreateUtil.autoCreateQueue(session, tempQueueName, selectorString); AutoCreateUtil.autoCreateQueue(session, tempQueueName, null);
} }
consumer = (ClientConsumerInternal) session.createConsumer(tempQueueName, selectorString); consumer = (ClientConsumerInternal) session.createConsumer(tempQueueName, selectorString);
} }

View File

@ -37,6 +37,7 @@ import org.apache.activemq.artemis.api.core.management.AddressControl;
import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl; import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination; import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
@ -194,6 +195,33 @@ public class ResourceAdapterTest extends ActiveMQRATestBase {
activation.stop(); activation.stop();
} }
@Test
public void testAutoCreatedQueueNotFiltered() throws Exception {
final String destinationName = "test";
ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
ra.setConnectorClassName(INVM_CONNECTOR_FACTORY);
ra.start(new BootstrapContext());
Connection conn = ra.getDefaultActiveMQConnectionFactory().createConnection();
conn.close();
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(ra);
spec.setJndiParams("java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory;");
spec.setMessageSelector("HeaderField = 'foo'");
spec.setDestinationType("javax.jms.Queue");
spec.setDestinationLookup(destinationName);
ActiveMQActivation activation = new ActiveMQActivation(ra, new MessageEndpointFactory(), spec);
activation.start();
Queue queue = server.locateQueue(destinationName);
assertNotNull(queue);
assertNull(queue.getFilter());
activation.stop();
}
@Test @Test
public void testStartStop() throws Exception { public void testStartStop() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter(); ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();