public ActiveMQConnection(final ConnectionFactoryOptions options, final String username, final String password, final int connectionType, final String clientID, final int dupsOKBatchSize, final int transactionBatchSize, final boolean cacheDestinations, final boolean enable1xPrefixes, final ClientSessionFactory sessionFactory) { this.options = options; this.username = username; this.password = password; this.connectionType = connectionType; this.clientID = clientID; this.sessionFactory = sessionFactory; uid = UUIDGenerator.getInstance().generateSimpleStringUUID(); thisVersion = VersionLoader.getVersion(); this.dupsOKBatchSize = dupsOKBatchSize; this.transactionBatchSize = transactionBatchSize; this.cacheDestinations = cacheDestinations; this.enable1xPrefixes = enable1xPrefixes; creationStack = new Exception(); }
public ClientProducerImpl(final ClientSessionInternal session, final SimpleString address, final TokenBucketLimiter rateLimiter, final boolean blockOnNonDurableSend, final boolean blockOnDurableSend, final boolean autoGroup, final SimpleString groupID, final int minLargeMessageSize, final SessionContext sessionContext) { this.sessionContext = sessionContext; this.session = session; this.address = address; this.rateLimiter = rateLimiter; this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnDurableSend = blockOnDurableSend; if (autoGroup) { this.groupID = UUIDGenerator.getInstance().generateSimpleStringUUID(); } else { this.groupID = groupID; } this.minLargeMessageSize = minLargeMessageSize; if (address != null) { producerCredits = session.getCredits(address, false); } else { producerCredits = null; } }
public InVMConnection(final int serverID, final String id, final BufferHandler handler, final BaseConnectionLifeCycleListener listener, final Executor executor) { this(serverID, id, handler, listener, executor, null); }
public ActiveMQConnection(final ConnectionFactoryOptions options, final String username, final String password, final int connectionType, final String clientID, final int dupsOKBatchSize, final int transactionBatchSize, final boolean cacheDestinations, final boolean enable1xPrefixes, final ClientSessionFactory sessionFactory) { this.options = options; this.username = username; this.password = password; this.connectionType = connectionType; this.clientID = clientID; this.sessionFactory = sessionFactory; uid = UUIDGenerator.getInstance().generateSimpleStringUUID(); thisVersion = VersionLoader.getVersion(); this.dupsOKBatchSize = dupsOKBatchSize; this.transactionBatchSize = transactionBatchSize; this.cacheDestinations = cacheDestinations; this.enable1xPrefixes = enable1xPrefixes; creationStack = new Exception(); }
public ActiveMQConnection(final ConnectionFactoryOptions options, final String username, final String password, final int connectionType, final String clientID, final int dupsOKBatchSize, final int transactionBatchSize, final boolean cacheDestinations, final boolean enable1xPrefixes, final ClientSessionFactory sessionFactory) { this.options = options; this.username = username; this.password = password; this.connectionType = connectionType; this.clientID = clientID; this.sessionFactory = sessionFactory; uid = UUIDGenerator.getInstance().generateSimpleStringUUID(); thisVersion = VersionLoader.getVersion(); this.dupsOKBatchSize = dupsOKBatchSize; this.transactionBatchSize = transactionBatchSize; this.cacheDestinations = cacheDestinations; this.enable1xPrefixes = enable1xPrefixes; creationStack = new Exception(); }
public ActiveMQConnection(final ConnectionFactoryOptions options, final String username, final String password, final int connectionType, final String clientID, final int dupsOKBatchSize, final int transactionBatchSize, final boolean cacheDestinations, final boolean enable1xPrefixes, final ClientSessionFactory sessionFactory) { this.options = options; this.username = username; this.password = password; this.connectionType = connectionType; this.clientID = clientID; this.sessionFactory = sessionFactory; uid = UUIDGenerator.getInstance().generateSimpleStringUUID(); thisVersion = VersionLoader.getVersion(); this.dupsOKBatchSize = dupsOKBatchSize; this.transactionBatchSize = transactionBatchSize; this.cacheDestinations = cacheDestinations; this.enable1xPrefixes = enable1xPrefixes; creationStack = new Exception(); }
public ActiveMQConnection(final ConnectionFactoryOptions options, final String username, final String password, final int connectionType, final String clientID, final int dupsOKBatchSize, final int transactionBatchSize, final boolean cacheDestinations, final boolean enable1xPrefixes, final ClientSessionFactory sessionFactory) { this.options = options; this.username = username; this.password = password; this.connectionType = connectionType; this.clientID = clientID; this.sessionFactory = sessionFactory; uid = UUIDGenerator.getInstance().generateSimpleStringUUID(); thisVersion = VersionLoader.getVersion(); this.dupsOKBatchSize = dupsOKBatchSize; this.transactionBatchSize = transactionBatchSize; this.cacheDestinations = cacheDestinations; this.enable1xPrefixes = enable1xPrefixes; creationStack = new Exception(); }
public ClientProducerImpl(final ClientSessionInternal session, final SimpleString address, final TokenBucketLimiter rateLimiter, final boolean blockOnNonDurableSend, final boolean blockOnDurableSend, final boolean autoGroup, final SimpleString groupID, final int minLargeMessageSize, final SessionContext sessionContext) { this.sessionContext = sessionContext; this.session = session; this.address = address; this.rateLimiter = rateLimiter; this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnDurableSend = blockOnDurableSend; if (autoGroup) { this.groupID = UUIDGenerator.getInstance().generateSimpleStringUUID(); } else { this.groupID = groupID; } this.minLargeMessageSize = minLargeMessageSize; if (address != null) { producerCredits = session.getCredits(address, false); } else { producerCredits = null; } }
public ClientProducerImpl(final ClientSessionInternal session, final SimpleString address, final TokenBucketLimiter rateLimiter, final boolean blockOnNonDurableSend, final boolean blockOnDurableSend, final boolean autoGroup, final SimpleString groupID, final int minLargeMessageSize, final SessionContext sessionContext) { this.sessionContext = sessionContext; this.session = session; this.address = address; this.rateLimiter = rateLimiter; this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnDurableSend = blockOnDurableSend; if (autoGroup) { this.groupID = UUIDGenerator.getInstance().generateSimpleStringUUID(); } else { this.groupID = groupID; } this.minLargeMessageSize = minLargeMessageSize; if (address != null) { producerCredits = session.getCredits(address, false); } else { producerCredits = null; } }
public ClientProducerImpl(final ClientSessionInternal session, final SimpleString address, final TokenBucketLimiter rateLimiter, final boolean blockOnNonDurableSend, final boolean blockOnDurableSend, final boolean autoGroup, final SimpleString groupID, final int minLargeMessageSize, final SessionContext sessionContext) { this.sessionContext = sessionContext; this.session = session; this.address = address; this.rateLimiter = rateLimiter; this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnDurableSend = blockOnDurableSend; if (autoGroup) { this.groupID = UUIDGenerator.getInstance().generateSimpleStringUUID(); } else { this.groupID = groupID; } this.minLargeMessageSize = minLargeMessageSize; if (address != null) { producerCredits = session.getCredits(address, false); } else { producerCredits = null; } }
public ClientProducerImpl(final ClientSessionInternal session, final SimpleString address, final TokenBucketLimiter rateLimiter, final boolean blockOnNonDurableSend, final boolean blockOnDurableSend, final boolean autoGroup, final SimpleString groupID, final int minLargeMessageSize, final SessionContext sessionContext) { this.sessionContext = sessionContext; this.session = session; this.address = address; this.rateLimiter = rateLimiter; this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnDurableSend = blockOnDurableSend; if (autoGroup) { this.groupID = UUIDGenerator.getInstance().generateSimpleStringUUID(); } else { this.groupID = groupID; } this.minLargeMessageSize = minLargeMessageSize; if (address != null) { producerCredits = session.getCredits(address, false); } else { producerCredits = null; } }
public ClientProducerImpl(final ClientSessionInternal session, final SimpleString address, final TokenBucketLimiter rateLimiter, final boolean blockOnNonDurableSend, final boolean blockOnDurableSend, final boolean autoGroup, final SimpleString groupID, final int minLargeMessageSize, final SessionContext sessionContext) { this.sessionContext = sessionContext; this.session = session; this.address = address; this.rateLimiter = rateLimiter; this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnDurableSend = blockOnDurableSend; if (autoGroup) { this.groupID = UUIDGenerator.getInstance().generateSimpleStringUUID(); } else { this.groupID = groupID; } this.minLargeMessageSize = minLargeMessageSize; if (address != null) { producerCredits = session.getCredits(address, false); } else { producerCredits = null; } }
public ClientProducerImpl(final ClientSessionInternal session, final SimpleString address, final TokenBucketLimiter rateLimiter, final boolean blockOnNonDurableSend, final boolean blockOnDurableSend, final boolean autoGroup, final SimpleString groupID, final int minLargeMessageSize, final SessionContext sessionContext) { this.sessionContext = sessionContext; this.session = session; this.address = address; this.rateLimiter = rateLimiter; this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnDurableSend = blockOnDurableSend; if (autoGroup) { this.groupID = UUIDGenerator.getInstance().generateSimpleStringUUID(); } else { this.groupID = groupID; } this.minLargeMessageSize = minLargeMessageSize; if (address != null) { producerCredits = session.getCredits(address, false); } else { producerCredits = null; } }
@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(); System.out.println("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(((ActiveMQConnection)connection).containsKnownDestination(addressName)); }
@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(); Connection connection = factory.createConnection(); SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); System.out.println("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(((ActiveMQConnection)connection).containsKnownDestination(addressName)); }
queueName = UUIDGenerator.getInstance().generateSimpleStringUUID(); session.createQueue(address, queueName, selectorSimple, true, false);
queueName = UUIDGenerator.getInstance().generateSimpleStringUUID(); session.createQueue(address, queueName, selectorSimple, true, false);
@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 testAutoCreateOnAddressOnly() throws Exception { server.getAddressSettingsRepository().clear(); AddressSettings settings = new AddressSettings().setAutoCreateAddresses(true).setAutoCreateQueues(false); server.getAddressSettingsRepository().addMatch("#", settings); ConnectionFactory factory = new ActiveMQConnectionFactory(); try (Connection connection = factory.createConnection()) { SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); System.out.println("Address is " + addressName); javax.jms.Queue queue = new ActiveMQQueue(addressName.toString()); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(null); try { producer.send(queue, session.createTextMessage("hello")); Assert.fail("Expected to throw exception here"); } catch (JMSException expected) { } Assert.assertFalse(((ActiveMQConnection)connection).containsKnownDestination(addressName)); } }
@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(((ActiveMQConnection) connection).containsKnownDestination(addressName)); } }
@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 testAutoCreateOnAddressOnlyDuringProducerCreate() throws Exception { server.getAddressSettingsRepository().clear(); AddressSettings settings = new AddressSettings().setAutoCreateAddresses(true).setAutoCreateQueues(false); server.getAddressSettingsRepository().addMatch("#", settings); ConnectionFactory factory = new ActiveMQConnectionFactory(); 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); try { MessageProducer producer = session.createProducer(queue); Assert.fail("Exception expected"); } catch (JMSException expected) { } Assert.assertFalse(((ActiveMQConnection)connection).containsKnownDestination(addressName)); }