91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 51.18MB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發布日期: 2022-06-30
  • 語言: 其他
  • 標簽: activemq5.13??

資源簡介

apache-activemq-5.13.1-bin.tar.gz

資源截圖

代碼片段和文件信息

/**
?*?Licensed?to?the?Apache?Software?Foundation?(ASF)?under?one?or?more
?*?contributor?license?agreements.??See?the?NOTICE?file?distributed?with
?*?this?work?for?additional?information?regarding?copyright?ownership.
?*?The?ASF?licenses?this?file?to?You?under?the?Apache?License?Version?2.0
?*?(the?“License“);?you?may?not?use?this?file?except?in?compliance?with
?*?the?License.??You?may?obtain?a?copy?of?the?License?at
?*
?*??????http://www.apache.org/licenses/LICENSE-2.0
?*
?*?Unless?required?by?applicable?law?or?agreed?to?in?writing?software
?*?distributed?under?the?License?is?distributed?on?an?“AS?IS“?BASIS
?*?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND?either?express?or?implied.
?*?See?the?License?for?the?specific?language?governing?permissions?and
?*?limitations?under?the?License.
?*/
package?example;

import?org.apache.qpid.jms.*;
import?javax.jms.*;

class?Listener?{

????public?static?void?main(String[]?args)?throws?JMSException?{

????????final?String?TOPIC_PREFIX?=?“topic://“;

????????String?user?=?env(“ACTIVEMQ_USER“?“admin“);
????????String?password?=?env(“ACTIVEMQ_PASSWORD“?“password“);
????????String?host?=?env(“ACTIVEMQ_HOST“?“localhost“);
????????int?port?=?Integer.parseInt(env(“ACTIVEMQ_PORT“?“5672“));

????????String?connectionURI?=?“amqp://“?+?host?+?“:“?+?port;
????????String?destinationName?=?arg(args?0?“topic://event“);

????????JmsConnectionFactory?factory?=?new?JmsConnectionFactory(connectionURI);

????????Connection?connection?=?factory.createConnection(user?password);
????????connection.start();
????????Session?session?=?connection.createSession(false?Session.AUTO_ACKNOWLEDGE);

????????Destination?destination?=?null;
????????if?(destinationName.startsWith(TOPIC_PREFIX))?{
????????????destination?=?session.createTopic(destinationName.substring(TOPIC_PREFIX.length()));
????????}?else?{
????????????destination?=?session.createQueue(destinationName);
????????}

????????MessageConsumer?consumer?=?session.createConsumer(destination);
????????long?start?=?System.currentTimeMillis();
????????long?count?=?1;
????????System.out.println(“Waiting?for?messages...“);
????????while?(true)?{
????????????Message?msg?=?consumer.receive();
????????????if?(msg?instanceof?TextMessage)?{
????????????????String?body?=?((TextMessage)?msg).getText();
????????????????if?(“SHUTDOWN“.equals(body))?{
????????????????????long?diff?=?System.currentTimeMillis()?-?start;
????????????????????System.out.println(String.format(“Received?%d?in?%.2f?seconds“?count?(1.0?*?diff?/?1000.0)));
????????????????????connection.close();
????????????????????try?{
????????????????????????Thread.sleep(10);
????????????????????}?catch?(Exception?e)?{}
????????????????????System.exit(1);
????????????????}?else?{
????????????????????try?{
????????????????????????if?(count?!=?msg.getIntProperty(“id“))?{
????????????????????????????System.out.println(“mismatch:?“?+?count?+?“!=“?+?msg.getIntProperty(“id“));
????????????????????????}
????????????????????}?catch?(

評論

共有 條評論

相關資源