Skip to content

Commit

Permalink
ARTEMIS-4188 auto-create + MDB using selector on queue
Browse files Browse the repository at this point in the history
  • Loading branch information
jbertram authored and clebertsuconic committed Mar 3, 2023
1 parent de7920d commit 6874556
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void setup() throws Exception {
}
} else {
tempQueueName = activation.getAddress();
AutoCreateUtil.autoCreateQueue(session, tempQueueName, selectorString);
AutoCreateUtil.autoCreateQueue(session, tempQueueName, null);
}
consumer = (ClientConsumerInternal) session.createConsumer(tempQueueName, selectorString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
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.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
Expand Down Expand Up @@ -194,6 +195,33 @@ public void testTopicPrefixWhenUseJndiIsFalse() throws Exception {
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
public void testStartStop() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
Expand Down

0 comments on commit 6874556

Please sign in to comment.