当前位置: 首页>>代码示例>>Java>>正文


Java QueueSession.createTemporaryQueue方法代码示例

本文整理汇总了Java中javax.jms.QueueSession.createTemporaryQueue方法的典型用法代码示例。如果您正苦于以下问题:Java QueueSession.createTemporaryQueue方法的具体用法?Java QueueSession.createTemporaryQueue怎么用?Java QueueSession.createTemporaryQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jms.QueueSession的用法示例。


在下文中一共展示了QueueSession.createTemporaryQueue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetQueue

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:JmsPoolQueueReceiverTest.java

示例2: testGetTopicSubscriber

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:JmsPoolQueueReceiverTest.java

示例3: doTestCreateQueueSender

import javax.jms.QueueSession; //导入方法依赖的package包/类
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();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:21,代码来源:JmsPoolWrappedProducersTest.java

示例4: testGetQueue

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:JmsPoolQueueSenderTest.java

示例5: testGetTopicSubscriber

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:JmsPoolQueueSenderTest.java

示例6: testGetQueue

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {
    }
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:19,代码来源:JmsQueueBrowserTest.java

示例7: testGetQueueBrowser

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {
    }
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:JmsQueueBrowserTest.java

示例8: testGetMessageSelector

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {
    }
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:19,代码来源:JmsQueueBrowserTest.java

示例9: testGetEnumeration

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {
    }
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:JmsQueueBrowserTest.java

示例10: testToString

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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());
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolQueueReceiverTest.java

示例11: testToString

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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());
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolQueueSenderTest.java

示例12: testSendToQueueFailsIfNotAnonymousPublisher

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:13,代码来源:JmsPoolQueueSenderTest.java

示例13: testToString

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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());
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsQueueBrowserTest.java

示例14: testQueueSender

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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());
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:14,代码来源:PooledSessionNoPublisherCachingTest.java

示例15: testQueueSender

import javax.jms.QueueSession; //导入方法依赖的package包/类
@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();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:15,代码来源:PooledSessionTest.java


注:本文中的javax.jms.QueueSession.createTemporaryQueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。