ARTEMIS-4188 auto-create + MDB using selector on queue
This commit is contained in:
parent
de7920d68a
commit
6874556f7c
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue