當前位置: 首頁>>代碼示例>>Java>>正文


Java TemporaryQueue.getQueueName方法代碼示例

本文整理匯總了Java中javax.jms.TemporaryQueue.getQueueName方法的典型用法代碼示例。如果您正苦於以下問題:Java TemporaryQueue.getQueueName方法的具體用法?Java TemporaryQueue.getQueueName怎麽用?Java TemporaryQueue.getQueueName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.jms.TemporaryQueue的用法示例。


在下文中一共展示了TemporaryQueue.getQueueName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testTemporaryQueueShouldNotBeInJNDI

import javax.jms.TemporaryQueue; //導入方法依賴的package包/類
@Test
public void testTemporaryQueueShouldNotBeInJNDI() throws Exception {
   Connection producerConnection = createConnection();

   Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);

   TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
   String queueName = tempQueue.getQueueName();

   try {
      ic.lookup("/queue/" + queueName);
      ProxyAssertSupport.fail("The temporary queue should not be bound to JNDI");
   } catch (NamingException e) {
      // Expected
   }
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:17,代碼來源:TemporaryDestinationTest.java

示例2: verifyConnection

import javax.jms.TemporaryQueue; //導入方法依賴的package包/類
/**
 * Verify whether the JMS connection was still validate.
 * 
 * @return result
 */
private boolean verifyConnection() {
	boolean result = false;
	TemporaryQueue tq = null;
	MessageProducer producer = null;
	MessageConsumer consumer = null;
	try {
		tq = this.session.createTemporaryQueue();
		producer = this.session.createProducer(tq);
		producer.setTimeToLive(Constants.ONE_MINUTE * 5);
		consumer = this.session.createConsumer(tq);
		String token = CommonUtils.generateToken();
		Message msg = this.session.createMessage();
		setProperty(msg, "heartbeat", token);
		producer.send(msg);
		Message msg2 = consumer.receive(Constants.ONE_SECOND * 30);
		if (msg2 != null && token.equals(getProperty(msg2, "heartbeat", "")))
			result = true;
	} catch (Exception e) {
		log.error("Verify Message Connection failed.", e);
	} finally {
		CommonUtils.closeQuietly(consumer);
		CommonUtils.closeQuietly(producer);
		String tqn = null;
		try {
			if (tq != null) {
				tqn = tq.getQueueName();
				tq.delete();
			}
		} catch (Exception ex) {
			log.error("Delete temporary queue[" + tqn + "] failed.", ex);
		}
	}
	return result;
}
 
開發者ID:slimsymphony,項目名稱:testgrid,代碼行數:40,代碼來源:MessageBroker.java

示例3: JmsTemporaryQueueEndpoint

import javax.jms.TemporaryQueue; //導入方法依賴的package包/類
public JmsTemporaryQueueEndpoint(TemporaryQueue jmsDestination) throws JMSException {
    super("jms:temp:queue:" + jmsDestination.getQueueName(), null);
    setDestinationType("temp:queue");
    this.jmsDestination = jmsDestination;
    setDestination(jmsDestination);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:7,代碼來源:JmsTemporaryQueueEndpoint.java


注:本文中的javax.jms.TemporaryQueue.getQueueName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。