Java Code Examples for javax.jms.QueueSession#createTemporaryQueue()
The following examples show how to use
javax.jms.QueueSession#createTemporaryQueue() .
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: JmsPoolQueueReceiverTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetQueue() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueReceiver receiver = session.createReceiver(queue); assertNotNull(receiver.getQueue()); assertSame(queue, receiver.getQueue()); receiver.close(); try { receiver.getQueue(); fail("Cannot read topic on closed receiver"); } catch (IllegalStateException ise) {} }
Example 2
Source File: JmsPoolQueueReceiverTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetTopicSubscriber() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); JmsPoolQueueReceiver receiver = (JmsPoolQueueReceiver) session.createReceiver(queue); assertNotNull(receiver.getQueueReceiver()); assertTrue(receiver.getQueueReceiver() instanceof MockJMSQueueReceiver); receiver.close(); try { receiver.getQueueReceiver(); fail("Cannot read state on closed receiver"); } catch (IllegalStateException ise) {} }
Example 3
Source File: JmsPoolWrappedProducersTest.java From pooled-jms with Apache License 2.0 | 6 votes |
private void doTestCreateQueueSender(boolean useAnonymousProducers) throws JMSException { cf.setUseAnonymousProducers(useAnonymousProducers); JmsPoolConnection connection = (JmsPoolConnection) cf.createConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue1 = session.createTemporaryQueue(); Queue queue2 = session.createTemporaryQueue(); JmsPoolQueueSender sender1 = (JmsPoolQueueSender) session.createSender(queue1); JmsPoolQueueSender sender2 = (JmsPoolQueueSender) session.createSender(queue2); if (useAnonymousProducers) { assertSame(sender1.getMessageProducer(), sender2.getMessageProducer()); } else { assertNotSame(sender1.getMessageProducer(), sender2.getMessageProducer()); } connection.close(); }
Example 4
Source File: JmsPoolQueueSenderTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetQueue() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueSender sender = session.createSender(queue); assertNotNull(sender.getQueue()); assertSame(queue, sender.getQueue()); sender.close(); try { sender.getQueue(); fail("Cannot read topic on closed sender"); } catch (IllegalStateException ise) {} }
Example 5
Source File: JmsPoolQueueSenderTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetTopicSubscriber() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); JmsPoolQueueSender sender = (JmsPoolQueueSender) session.createSender(queue); assertNotNull(sender.getQueueSender()); assertTrue(sender.getQueueSender() instanceof MockJMSQueueSender); sender.close(); try { sender.getQueueSender(); fail("Cannot read state on closed sender"); } catch (IllegalStateException ise) {} }
Example 6
Source File: JmsQueueBrowserTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetQueue() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueBrowser browser = session.createBrowser(queue); assertNotNull(browser.getQueue()); browser.close(); browser.close(); try { browser.getQueue(); fail("Should not be able to use a closed browser"); } catch (IllegalStateException ise) { } }
Example 7
Source File: JmsQueueBrowserTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetQueueBrowser() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); JmsPoolQueueBrowser browser = (JmsPoolQueueBrowser) session.createBrowser(queue); assertNotNull(browser.getQueueBrowser()); browser.close(); try { browser.getQueueBrowser(); fail("Should not be able to use a closed browser"); } catch (IllegalStateException ise) { } }
Example 8
Source File: JmsQueueBrowserTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetMessageSelector() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueBrowser browser = session.createBrowser(queue, "color = red"); assertNotNull(browser.getMessageSelector()); assertEquals("color = red", browser.getMessageSelector()); browser.close(); try { browser.getMessageSelector(); fail("Should not be able to use a closed browser"); } catch (IllegalStateException ise) { } }
Example 9
Source File: JmsQueueBrowserTest.java From pooled-jms with Apache License 2.0 | 6 votes |
@Test public void testGetEnumeration() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueBrowser browser = session.createBrowser(queue); assertNotNull(browser.getEnumeration()); browser.close(); try { browser.getEnumeration(); fail("Should not be able to use a closed browser"); } catch (IllegalStateException ise) { } }
Example 10
Source File: CreateTemporaryQueueBeforeStartTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
public void testTryToReproduceNullPointerBug() throws Exception { String url = connectionUri; ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url); QueueConnection queueConnection = factory.createQueueConnection(); this.connection = queueConnection; QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); session.createSender(null); // Unidentified Queue receiverQueue = session.createTemporaryQueue(); session.createReceiver(receiverQueue); queueConnection.start(); }
Example 11
Source File: JmsPoolQueueReceiverTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testToString() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueReceiver receiver = session.createReceiver(queue); assertNotNull(receiver.toString()); }
Example 12
Source File: SimpleOpenWireTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testTempQueueDelete() throws Exception { connection.start(); QueueSession queueSession = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); TemporaryQueue tempQueue = queueSession.createTemporaryQueue(); ActiveMQConnection newConn = (ActiveMQConnection) factory.createConnection(); try { QueueSession newQueueSession = newConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); QueueSender queueSender = newQueueSession.createSender(tempQueue); Message msg = queueSession.createMessage(); queueSender.send(msg); try { QueueReceiver consumer = newQueueSession.createReceiver(tempQueue); fail("should have gotten exception but got consumer: " + consumer); } catch (JMSException ex) { //correct } connection.close(); try { Message newMsg = newQueueSession.createMessage(); queueSender.send(newMsg); } catch (JMSException e) { //ok } } finally { newConn.close(); } }
Example 13
Source File: PooledSessionTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testQueueSender() throws Exception { JmsPoolConnection connection = (JmsPoolConnection) pooledFactory.createConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue1 = session.createTemporaryQueue(); Queue queue2 = session.createTemporaryQueue(); JmsPoolQueueSender sender1 = (JmsPoolQueueSender) session.createSender(queue1); JmsPoolQueueSender sender2 = (JmsPoolQueueSender) session.createSender(queue2); assertSame(sender1.getMessageProducer(), sender2.getMessageProducer()); connection.close(); }
Example 14
Source File: PooledSessionNoPublisherCachingTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testQueueSender() throws Exception { JmsPoolConnection connection = (JmsPoolConnection) pooledFactory.createConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue1 = session.createTemporaryQueue(); Queue queue2 = session.createTemporaryQueue(); JmsPoolQueueSender sender1 = (JmsPoolQueueSender) session.createSender(queue1); JmsPoolQueueSender sender2 = (JmsPoolQueueSender) session.createSender(queue2); assertNotSame(sender1.getMessageProducer(), sender2.getMessageProducer()); }
Example 15
Source File: JmsQueueBrowserTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testToString() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueBrowser browser = session.createBrowser(queue); assertNotNull(browser.toString()); }
Example 16
Source File: JmsPoolQueueSenderTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testSendToQueueFailsIfNotAnonymousPublisher() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createTopicConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueSender sender = session.createSender(queue); try { sender.send(session.createTemporaryQueue(), session.createTextMessage()); fail("Should not be able to send to alternate destination"); } catch (UnsupportedOperationException ex) {} }
Example 17
Source File: JmsPoolQueueSenderTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testToString() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); QueueSender sender = session.createSender(queue); assertNotNull(sender.toString()); }