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


Java Proton.reactor方法代码示例

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


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

示例1: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {

        // You can pass multiple handlers to a reactor when you construct it.
        // Each of these handlers will see every event the reactor sees. By
        // combining this with on_unhandled, you can log each event that goes
        // to the reactor.
        Reactor reactor = Proton.reactor(new ReactorLogger(), new Logger());
        reactor.run();

        // Note that if you wanted to add the logger later, you could also
        // write the above as below. All arguments to the reactor are just
        // added to the default handler for the reactor.
        reactor = Proton.reactor(new ReactorLogger());
        if (loggingEnabled)
            reactor.getHandler().add(new Logger());
        reactor.run();
    }
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:18,代码来源:ReactorLogger.java

示例2: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    int port = 5672;
    String host = "localhost";
    if (args.length > 0) {
        String[] parts = args[0].split(":", 2);
        host = parts[0];
        if (parts.length > 1) {
            port = Integer.parseInt(parts[1]);
        }
    }
    String content = args.length > 1 ? args[1] : "Hello World!";

    Reactor r = Proton.reactor(new Send(host, port, content));
    r.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:16,代码来源:Send.java

示例3: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    // In HelloWorld.java we said the reactor exits when there are no more
    // events to process. While this is true, it's not actually complete.
    // The reactor exits when there are no more events to process and no
    // possibility of future events arising. For that reason the reactor
    // will keep running until there are no more scheduled events and then
    // exit.
    Reactor reactor = Proton.reactor(new CountRandomly());
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:CountRandomly.java

示例4: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Reactor reactor = Proton.reactor(new GlobalLogger());

    // In addition to having a regular handler, the reactor also has a
    // global handler that sees every event. By adding the Logger to the
    // global handler instead of the regular handler, we can log every
    // single event that occurs in the system regardless of whether or not
    // there are specific handlers associated with the objects that are the
    // target of those events.
    reactor.getGlobalHandler().add(new Logger());
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:13,代码来源:GlobalLogger.java

示例5: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    // In HelloWorld.java we said the reactor exits when there are no more
    // events to process. While this is true, it's not actually complete.
    // The reactor exits when there are no more events to process and no
    // possibility of future events arising. For that reason the reactor
    // will keep running until there are no more scheduled events and then
    // exit.
    Reactor reactor = Proton.reactor(new Counter());
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:Counter.java

示例6: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    if (args.length != 1) {
        System.err.println("Specify a file name as an argument.");
        System.exit(1);
    }
    FileInputStream inFile = new FileInputStream(args[0]);
    SourceChannel inChannel = EchoInputStreamWrapper.wrap(inFile);
    Reactor reactor = Proton.reactor(new Cat(inChannel));
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:Cat.java

示例7: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {

        // When you construct a reactor, you can give it a handler that
        // is used, by default, to receive events generated by the reactor.
        Reactor reactor = Proton.reactor(new HelloWorld());

        // When you call run, the reactor will process events. The reactor init
        // event is what kicks off everything else. When the reactor has no
        // more events to process, it exits.
        reactor.run();
    }
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:HelloWorld.java

示例8: data

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
@Parameters
public static Collection<ReactorFactory[]> data() throws IOException {
    ReactorFactory classicReactor = new ReactorFactory() {
        @Override public Reactor newReactor() throws IOException {
            return Proton.reactor();
        }
    };
    ReactorFactory newLeakDetection = new ReactorFactory() {
        @Override public Reactor newReactor() throws IOException {
            return new LeakTestReactor();
        }
    };
    return Arrays.asList(new ReactorFactory[][]{{classicReactor}, {newLeakDetection}});
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:15,代码来源:ReactorTest.java

示例9: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    SourceChannel inChannel = EchoInputStreamWrapper.wrap(System.in);
    Reactor reactor = Proton.reactor(new Echo(inChannel));
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:6,代码来源:Echo.java

示例10: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Reactor reactor = Proton.reactor(new GoodbyeWorld());
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:5,代码来源:GoodbyeWorld.java

示例11: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Reactor reactor = Proton.reactor(new Delegates(new Hello(), new Goodbye()));
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:5,代码来源:Delegates.java

示例12: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Reactor reactor = Proton.reactor(new Scheduling());
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:5,代码来源:Scheduling.java

示例13: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Reactor r = Proton.reactor(new Recv());
    r.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:5,代码来源:Recv.java

示例14: main

import org.apache.qpid.proton.Proton; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Reactor reactor = Proton.reactor(new Unhandled());
    reactor.run();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:5,代码来源:Unhandled.java


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