本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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}});
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}