apache-apollo-1.7.1


apache-apollo-1.7.1
资源截图
代码片段和文件信息
/**
 * 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.amqp_1_0.jms.impl.*;
import javax.jms.*;

class Listener {

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

        String user = env(“APOLLO_USER“ “admin“);
        String password = env(“APOLLO_PASSWORD“ “password“);
        String host = env(“APOLLO_HOST“ “localhost“);
        int port = Integer.parseInt(env(“APOLLO_PORT“ “61613“));
        String destination = arg(args 0 “topic://event“);

        ConnectionFactoryImpl factory = new ConnectionFactoryImpl(host port user password);
        Destination dest = null;
        if( destination.startsWith(“topic://“) ) {
            dest = new TopicImpl(destination);
        } else {
            dest = new QueueImpl(destination);
        }

        Connection connection = factory.createConnection(user password);
        connection.start();
        Session session = connection.createSession(false Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = session.createConsumer(dest);
        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();
                    System.exit(1);
                } else {
                    try {
                        if( count != msg.getIntProperty(“id“) ) {
                            System.out.println(“mismatch: “+count+“!=“+msg.getIntProperty(“id“));
                        }
                    } catch (NumberFormatException ignore) {
                    }
                    if( count == 1 ) {
                        start = System.currentTimeMillis();
                    } else if( count % 1000 == 0 ) {
                        System.o

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-01-29 10:55  apache-apollo-1.7.1
     目录           0  2015-01-29 10:55  apache-apollo-1.7.1lib
     文件      123878  2015-01-29 10:54  apache-apollo-1.7.1libapollo-cli-1.7.1.jar
     文件     7114639  2014-11-20 18:56  apache-apollo-1.7.1libscala-library-2.10.0.jar
     文件       86653  2014-12-03 12:12  apache-apollo-1.7.1libairline-0.6.jar
     文件        2497  2014-11-20 18:45  apache-apollo-1.7.1libjavax.inject-1.jar
     文件     1795936  2014-11-25 08:18  apache-apollo-1.7.1libguava-12.0.jar
     文件      114415  2014-11-20 18:29  apache-apollo-1.7.1libjansi-1.11.jar
     文件      131443  2014-12-02 09:07  apache-apollo-1.7.1libjasypt-1.6.jar
     文件      207723  2014-11-20 18:18  apache-apollo-1.7.1libcommons-lang-2.1.jar
     文件       18874  2014-12-02 09:07  apache-apollo-1.7.1libcommons-codec-1.1.jar
     文件      416580  2015-01-29 10:49  apache-apollo-1.7.1libapollo-leveldb-1.7.1.jar
     文件     1778184  2015-01-29 10:47  apache-apollo-1.7.1libapollo-broker-1.7.1.jar
     文件       83968  2015-01-29 10:46  apache-apollo-1.7.1libapollo-dto-1.7.1.jar
     文件      206234  2014-12-02 09:07  apache-apollo-1.7.1libjackson-core-2.1.0.jar
     文件       34251  2014-12-02 09:07  apache-apollo-1.7.1libjackson-annotations-2.1.0.jar
     文件      920971  2014-12-02 09:07  apache-apollo-1.7.1libjackson-databind-2.1.0.jar
     文件      471795  2015-01-29 10:46  apache-apollo-1.7.1libapollo-util-1.7.1.jar
     文件       25496  2014-12-02 09:07  apache-apollo-1.7.1libslf4j-api-1.6.1.jar
     文件      106334  2015-01-29 10:46  apache-apollo-1.7.1libapollo-selector-1.7.1.jar
     文件      127595  2014-11-26 09:47  apache-apollo-1.7.1libhawtdispatch-transport-1.20.jar
     文件      119046  2014-11-26 09:47  apache-apollo-1.7.1libhawtdispatch-1.20.jar
     文件      137411  2014-11-20 19:29  apache-apollo-1.7.1libhawtdispatch-scala-1.20.jar
     文件       30878  2014-11-20 19:29  apache-apollo-1.7.1libactivemq-jaas-5.7.0.jar
     文件       27252  2014-11-20 19:29  apache-apollo-1.7.1libhawtbuf-proto-1.10.jar
     文件       50150  2014-11-24 15:28  apache-apollo-1.7.1libhawtbuf-1.10.jar
     文件      253432  2014-11-20 19:29  apache-apollo-1.7.1libsnakeyaml-1.7.jar
     文件        9242  2014-11-20 18:51  apache-apollo-1.7.1libleveldb-api-0.6.jar
     文件      228800  2014-11-20 18:51  apache-apollo-1.7.1libleveldb-0.6.jar
     文件       56364  2014-11-25 08:18  apache-apollo-1.7.1libleveldbjni-1.8.jar
     文件       19705  2014-11-25 08:18  apache-apollo-1.7.1libhawtjni-runtime-1.9.jar
............此处省略1178个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)