org.apache.activemq.artemis.api.core.RoutingType Java Examples
The following examples show how to use
org.apache.activemq.artemis.api.core.RoutingType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BrokerDefinedMulticastConsumerTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test(timeout = 60000) public void testConsumeFromSingleQueueOnAddressSameName() throws Exception { server.addAddressInfo(new AddressInfo(address, RoutingType.MULTICAST)); server.createQueue(new QueueConfiguration(address)); sendMessages(address.toString(), 1); AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); AmqpSession session = connection.createSession(); AmqpReceiver receiver = session.createReceiver(address.toString() + "::" + address.toString()); receiver.flow(1); AmqpMessage amqpMessage = receiver.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); assertEquals(1, ((QueueImpl)server.getPostOffice().getBinding(address).getBindable()).getConsumerCount()); receiver.close(); connection.close(); }
Example #2
Source File: AutoCreateJmsDestinationTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test (timeout = 30000) // QueueAutoCreationTest was created to validate auto-creation of queues // and this test was added to validate a regression: https://issues.apache.org/jira/browse/ARTEMIS-2238 public void testAutoCreateOnAddressOnlyDuringProducerCreateQueueSucceed() throws Exception { server.getAddressSettingsRepository().clear(); AddressSettings settings = new AddressSettings().setAutoCreateAddresses(true).setAutoCreateQueues(true); server.getAddressSettingsRepository().addMatch("#", settings); ConnectionFactory factory = cf; try (Connection connection = factory.createConnection()) { SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); clientSession.createAddress(addressName, RoutingType.ANYCAST, true); // this will force the system to create the address only javax.jms.Queue queue = new ActiveMQQueue(addressName.toString()); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(queue); Assert.assertNotNull(server.locateQueue(addressName)); Assert.assertTrue(((ActiveMQDestination) queue).isCreated()); } }
Example #3
Source File: AMQPToJMSCoreTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false) .setAutoCreateAddresses(false) .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); }
Example #4
Source File: MessageSerializerTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testAnycastQueueToMulticastTopicBothAddress() throws Exception { String address = "testBoth"; String clientId = "test-client-id"; File file = createMessageFile(); connection.setClientID(clientId); createBothTypeAddress(address); createQueue(RoutingType.ANYCAST, address, address); Session session = createSession(connection); TopicSubscriber subscriber = session.createDurableSubscriber(session.createTopic(address), "test-subscriber"); List<Message> messages = generateTextMessages(session, getDestination(address)); exportMessages(address, file); importMessages(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + address, file); for (int i = 0; i < TEST_MESSAGE_COUNT; i++) { TextMessage messageReceived = (TextMessage) subscriber.receive(1000); assertNotNull(messageReceived); assertEquals(((TextMessage) messages.get(i)).getText(), messageReceived.getText()); } }
Example #5
Source File: AMQPSessionCallback.java From activemq-artemis with Apache License 2.0 | 6 votes |
public QueueQueryResult queueQuery(SimpleString queueName, RoutingType routingType, boolean autoCreate) throws Exception { QueueQueryResult queueQueryResult = serverSession.executeQueueQuery(queueName); if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateQueues() && autoCreate) { try { serverSession.createQueue(new QueueConfiguration(queueName).setRoutingType(routingType).setAutoCreated(true)); } catch (ActiveMQQueueExistsException e) { // The queue may have been created by another thread in the mean time. Catch and do nothing. } queueQueryResult = serverSession.executeQueueQuery(queueName); } // if auto-create we will return whatever type was used before if (queueQueryResult.isExists() && !queueQueryResult.isAutoCreated()) { //if routingType is null we bypass the check if (routingType != null && queueQueryResult.getRoutingType() != routingType) { throw new IllegalStateException("Incorrect Routing Type for queue, expecting: " + routingType); } } return queueQueryResult; }
Example #6
Source File: ActiveMQServerImpl.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Deprecated @Override public Queue updateQueue(String name, RoutingType routingType, String filterString, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, String groupFirstKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, String user) throws Exception { return updateQueue(name, routingType, filterString, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, null); }
Example #7
Source File: StompTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
public void sendMessageToNonExistentQueue(String queuePrefix, String queue, RoutingType routingType) throws Exception { conn.connect(defUser, defPass); send(conn, queuePrefix + queue, null, "Hello World", true, routingType); MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createQueue(queue)); TextMessage message = (TextMessage) consumer.receive(1000); Assert.assertNotNull(message); Assert.assertEquals("Hello World", message.getText()); // Assert default priority 4 is used when priority header is not set Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority()); // Make sure that the timestamp is valid - should // be very close to the current time. long tnow = System.currentTimeMillis(); long tmsg = message.getJMSTimestamp(); Assert.assertTrue(Math.abs(tnow - tmsg) < 1500); // closing the consumer here should trigger auto-deletion assertNotNull(server.getPostOffice().getBinding(new SimpleString(queue))); consumer.close(); Wait.assertTrue(() -> server.getPostOffice().getBinding(new SimpleString(queue)) == null); }
Example #8
Source File: BrokerDefinedAnycastConsumerTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test(timeout = 60000) public void testConsumeWhenNoAddressHasBothRoutingTypesButDefaultQueueIsMultiCast() throws Exception { AddressInfo addressInfo = new AddressInfo(address); addressInfo.getRoutingTypes().add(RoutingType.ANYCAST); addressInfo.getRoutingTypes().add(RoutingType.MULTICAST); server.addAddressInfo(addressInfo); server.createQueue(new QueueConfiguration(address)); AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); AmqpSession session = connection.createSession(); try { session.createReceiver(address.toString()); fail("expected exception"); } catch (Exception e) { //ignore } connection.close(); }
Example #9
Source File: AmqpPluginTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override public void sendMessages(String destinationName, int count, RoutingType routingType) throws Exception { AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); try { AmqpSession session = connection.createSession(); AmqpSender sender = session.createSender(destinationName); for (int i = 0; i < count; ++i) { AmqpMessage message = new AmqpMessage(); message.setMessageId("MessageID:" + i); if (routingType != null) { message.setMessageAnnotation(AMQPMessageSupport.ROUTING_TYPE.toString(), routingType.getType()); } sender.send(message); } } finally { connection.close(); } }
Example #10
Source File: QueueAutoCreationTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test(timeout = 30000) // QueueAutoCreationTest was created to validate auto-creation of queues // and this test was added to validate a regression: https://issues.apache.org/jira/browse/ARTEMIS-2238 public void testAutoCreateOnTopic() throws Exception { ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:5672"); Connection connection = factory.createConnection(); SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); instanceLog.debug("Address is " + addressName); clientSession.createAddress(addressName, RoutingType.ANYCAST, false); Topic topic = new ActiveMQTopic(addressName.toString()); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(topic); for (int i = 0; i < 10; i++) { producer.send(session.createTextMessage("hello")); } Assert.assertTrue(((ActiveMQDestination) topic).isCreated()); }
Example #11
Source File: ServerSession.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, SimpleString filterString, boolean temporary, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreated) throws Exception;
Example #12
Source File: AddressControlTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testGetRoutingTypes() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); session.createAddress(address, RoutingType.ANYCAST, false); AddressControl addressControl = createManagementControl(address); String[] routingTypes = addressControl.getRoutingTypes(); Assert.assertEquals(1, routingTypes.length); Assert.assertEquals(RoutingType.ANYCAST.toString(), routingTypes[0]); address = RandomUtil.randomSimpleString(); EnumSet<RoutingType> types = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); session.createAddress(address, types, false); addressControl = createManagementControl(address); routingTypes = addressControl.getRoutingTypes(); Set<String> strings = new HashSet<>(Arrays.asList(routingTypes)); Assert.assertEquals(2, strings.size()); Assert.assertTrue(strings.contains(RoutingType.ANYCAST.toString())); Assert.assertTrue(strings.contains(RoutingType.MULTICAST.toString())); }
Example #13
Source File: ConsumerFilterTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(false); server.start(); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); session = sf.createSession(); session.start(); session.createQueue(new QueueConfiguration("foo").setRoutingType(RoutingType.ANYCAST)); producer = session.createProducer("foo"); consumer = session.createConsumer("foo", "animal='giraffe'"); }
Example #14
Source File: ServerSession.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, SimpleString filterString, boolean temporary, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreated) throws Exception;
Example #15
Source File: JMSNonDestructiveTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected void createAddressAndQueues(ActiveMQServer server) throws Exception { super.createAddressAndQueues(server); //Add Non Destructive Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add Non Destructive Expiry Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add Non Destructive Last Value Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_LVQ_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_LVQ_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add Non Destructive Last Value Queue for Tombstone Test server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); }
Example #16
Source File: ClientSessionImpl.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Deprecated @Override public void createTemporaryQueue(final SimpleString address, final RoutingType routingType, final SimpleString queueName, final SimpleString filter, final int maxConsumers, final boolean purgeOnNoConsumers, final Boolean exclusive, final Boolean lastValue) throws ActiveMQException { internalCreateQueue(address, queueName, true, false, new QueueAttributes() .setRoutingType(routingType) .setFilterString(filter) .setDurable(false) .setPurgeOnNoConsumers(purgeOnNoConsumers) .setMaxConsumers(maxConsumers) .setExclusive(exclusive) .setLastValue(lastValue)); }
Example #17
Source File: PageCursorStressTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
/** * @throws Exception */ private void createServer() throws Exception { OperationContextImpl.clearContext(); Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(true); server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>()); server.start(); queueList.clear(); try { queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); queue.pause(); } catch (Exception ignored) { } }
Example #18
Source File: AmqpSenderRoutingTypeTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testAMQPSenderCreateQueueWithDefaultRoutingTypeIfAddressDoNotExist() throws Exception { RoutingType defaultRoutingType = server.getConfiguration().getAddressesSettings().get("#").getDefaultAddressRoutingType(); Assert.assertEquals(RoutingType.ANYCAST, defaultRoutingType); try (ActiveMQConnection coreConnection = (ActiveMQConnection) createCoreConnection(); ClientSession clientSession = coreConnection.getSessionFactory().createSession()) { SimpleString address = SimpleString.toSimpleString("myTopic_" + UUID.randomUUID().toString()); ClientSession.AddressQuery addressQuery = clientSession.addressQuery(address); Assert.assertFalse(addressQuery.isExists()); Assert.assertTrue(addressQuery.getQueueNames().isEmpty()); AmqpClient client = createAmqpClient(guestUser, guestPass); AmqpConnection connection = addConnection(client.connect()); AmqpSession session = connection.createSession(); AmqpSender sender = session.createSender(address.toString()); try { addressQuery = clientSession.addressQuery(address); Assert.assertTrue(addressQuery.isExists()); Assert.assertThat(addressQuery.getQueueNames(), CoreMatchers.hasItem(address)); ClientSession.QueueQuery queueQuery = clientSession.queueQuery(address); Assert.assertTrue(queueQuery.isExists()); Assert.assertEquals(defaultRoutingType, queueQuery.getRoutingType()); } finally { sender.close(); session.close(); connection.close(); } } }
Example #19
Source File: AddressQueryTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testAddressQueryNonDefaultsOnStaticAddress() throws Exception { SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setAutoCreateAddresses(false).setDefaultMaxConsumers(1).setDefaultPurgeOnNoConsumers(true)); server.addAddressInfo(new AddressInfo(addressName).addRoutingType(RoutingType.ANYCAST)); AddressQueryResult addressQueryResult = server.addressQuery(addressName); assertTrue(addressQueryResult.isExists()); assertTrue(addressQueryResult.getRoutingTypes().contains(RoutingType.ANYCAST)); assertFalse(addressQueryResult.getRoutingTypes().contains(RoutingType.MULTICAST)); assertEquals(addressName, addressQueryResult.getName()); assertFalse(addressQueryResult.isAutoCreateAddresses()); assertEquals(1, addressQueryResult.getDefaultMaxConsumers()); assertFalse(addressQueryResult.isAutoCreated()); assertTrue(addressQueryResult.isDefaultPurgeOnNoConsumers()); }
Example #20
Source File: ActiveMQServerImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Deprecated @Override public void createSharedQueue(final SimpleString address, RoutingType routingType, final SimpleString name, final SimpleString filterString, final SimpleString user, boolean durable) throws Exception { AddressSettings as = getAddressSettingsRepository().getMatch(address == null ? name.toString() : address.toString()); createSharedQueue(address, routingType, name, filterString, user, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isDefaultExclusiveQueue(), as.isDefaultLastValueQueue()); }
Example #21
Source File: MethodCalledVerifier.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override public void beforeUpdateAddress(SimpleString address, EnumSet<RoutingType> routingTypes) throws ActiveMQException { Preconditions.checkNotNull(address); Preconditions.checkNotNull(routingTypes); methodCalled(BEFORE_UPDATE_ADDRESS); }
Example #22
Source File: ClientSessionImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override public void createQueue(final String address, final RoutingType routingType, final String queueName, final String filterString, final boolean durable, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException { createQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), durable, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, lastValue); }
Example #23
Source File: ActiveMQServerImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Deprecated @Override public Queue updateQueue(String name, RoutingType routingType, String filterString, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, String groupFirstKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, String user, Long ringSize) throws Exception { return updateQueue(new QueueConfiguration(name) .setRoutingType(routingType) .setFilterString(filterString) .setMaxConsumers(maxConsumers) .setPurgeOnNoConsumers(purgeOnNoConsumers) .setExclusive(exclusive) .setGroupRebalance(groupRebalance) .setGroupBuckets(groupBuckets) .setGroupFirstKey(groupFirstKey) .setNonDestructive(nonDestructive) .setConsumersBeforeDispatch(consumersBeforeDispatch) .setDelayBeforeDispatch(delayBeforeDispatch) .setUser(user) .setRingSize(ringSize)); }
Example #24
Source File: NettyMultiThreadRandomReattachTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void start() throws Exception { Configuration liveConf = createDefaultNettyConfig(); server = createServer(false, liveConf); server.getConfiguration().getAddressConfigurations().add(new CoreAddressConfiguration().setName(ADDRESS.toString()).addRoutingType(RoutingType.MULTICAST)); server.start(); waitForServerToStart(server); }
Example #25
Source File: StompWithLargeMessagesTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testSendReceiveLargeMessage() throws Exception { StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri); try { String address = "testLargeMessageAddress"; server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); // STOMP default is UTF-8 == 1 byte per char. int largeMessageStringSize = 10 * 1024 * 1024; // 10MB StringBuilder b = new StringBuilder(largeMessageStringSize); for (int i = 0; i < largeMessageStringSize; i++) { b.append('t'); } String payload = b.toString(); // Set up STOMP subscription conn.connect(defUser, defPass); subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO, null, null, address, true); // Send Large Message send(conn, address, null, payload); // Receive STOMP Message ClientStompFrame frame = conn.receiveFrame(); assertTrue(frame.getBody().equals(payload)); } finally { conn.disconnect(); } }
Example #26
Source File: SessionContext.java From activemq-artemis with Apache License 2.0 | 5 votes |
public abstract void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filterString, boolean durable, boolean temp, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated, Boolean exclusive, Boolean lastVale) throws ActiveMQException;
Example #27
Source File: ClientSessionImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * Creates Shared queue. A queue that will exist as long as there are consumers or is durable. * * @param address the queue will be bound to this address * @param routingType the delivery mode for this queue, MULTICAST or ANYCAST * @param queueName the name of the queue * @param filter whether the queue is durable or not * @param durable if the queue is durable * @param maxConsumers how many concurrent consumers will be allowed on this queue * @param purgeOnNoConsumers whether to delete the contents of the queue when the last consumer disconnects * @param exclusive if the queue is exclusive queue * @param lastValue if the queue is last value queue * @throws ActiveMQException in an exception occurs while creating the queue */ @Deprecated @Override public void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException { QueueAttributes queueAttributes = new QueueAttributes() .setRoutingType(routingType) .setFilterString(filter) .setDurable(durable) .setPurgeOnNoConsumers(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers()) .setMaxConsumers(ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()) .setExclusive(exclusive) .setLastValue(lastValue); createSharedQueue(address, queueName, queueAttributes); }
Example #28
Source File: ActiveMQServerImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, final SimpleString queueName, final SimpleString filterString, final SimpleString user, final boolean durable, final boolean temporary, final boolean ignoreIfExists, final boolean transientQueue, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers, final boolean exclusive, final boolean groupRebalance, final int groupBuckets, final SimpleString groupFirstKey, final boolean lastValue, final SimpleString lastValueKey, final boolean nonDestructive, final int consumersBeforeDispatch, final long delayBeforeDispatch, final boolean autoDelete, final long autoDeleteDelay, final long autoDeleteMessageCount, final boolean autoCreateAddress) throws Exception { AddressSettings as = getAddressSettingsRepository().getMatch(address == null ? queueName.toString() : address.toString()); return createQueue(new AddressInfo(address).addRoutingType(routingType), queueName, filterString, user, durable, temporary, ignoreIfExists, transientQueue, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize()); }
Example #29
Source File: ServerSessionImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString name, RoutingType routingType, SimpleString filterString, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount) throws Exception { createSharedQueue(new QueueConfiguration(name) .setAddress(address) .setFilterString(filterString) .setUser(getUsername()) .setDurable(durable) .setMaxConsumers(maxConsumers) .setPurgeOnNoConsumers(purgeOnNoConsumers) .setExclusive(exclusive) .setGroupRebalance(groupRebalance) .setGroupBuckets(groupBuckets) .setLastValue(lastValue) .setLastValueKey(lastValueKey) .setNonDestructive(nonDestructive) .setConsumersBeforeDispatch(consumersBeforeDispatch) .setDelayBeforeDispatch(delayBeforeDispatch) .setAutoDelete(autoDelete) .setAutoDeleteDelay(autoDeleteDelay) .setAutoDeleteMessageCount(autoDeleteMessageCount)); }
Example #30
Source File: AmqpMessageRoutingTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * If we have an address configured with both ANYCAST and MULTICAST routing types enabled, we must ensure that any * messages sent specifically to MULTICAST (e.g. JMS TopicProducer) are only delivered to MULTICAST queues (e.g. * i.e. subscription queues) and **NOT** to ANYCAST queues (e.g. JMS Queue). * * @throws Exception */ @Test(timeout = 60000) public void testRoutingExclusivity() throws Exception { // Create Address with both ANYCAST and MULTICAST enabled String testAddress = "testRoutingExclusivity-mixed-mode"; SimpleString ssTestAddress = new SimpleString(testAddress); AddressInfo addressInfo = new AddressInfo(ssTestAddress); addressInfo.addRoutingType(RoutingType.MULTICAST); addressInfo.addRoutingType(RoutingType.ANYCAST); server.addAddressInfo(addressInfo); server.createQueue(new QueueConfiguration(ssTestAddress).setRoutingType(RoutingType.ANYCAST)); Connection connection = createConnection(UUIDGenerator.getInstance().generateStringUUID()); try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic(testAddress); javax.jms.Queue queue = session.createQueue(testAddress); MessageProducer producer = session.createProducer(topic); MessageConsumer queueConsumer = session.createConsumer(queue); MessageConsumer topicConsumer = session.createConsumer(topic); producer.send(session.createTextMessage("testMessage")); assertNotNull(topicConsumer.receive(1000)); assertNull(queueConsumer.receive(1000)); } finally { connection.close(); } }