本文整理汇总了Java中net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder类的典型用法代码示例。如果您正苦于以下问题:Java SingleChronicleQueueBuilder类的具体用法?Java SingleChronicleQueueBuilder怎么用?Java SingleChronicleQueueBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingleChronicleQueueBuilder类属于net.openhft.chronicle.queue.impl.single包,在下文中一共展示了SingleChronicleQueueBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeNonSerial
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void writeNonSerial() {
//for(int t=0; t<5; t++) {
// new Thread(() -> {
try (ChronicleQueue queue = SingleChronicleQueueBuilder.binary(file).bufferCapacity(1000).build()) {
final ExcerptAppender appender = queue.acquireAppender();
for (int i = 0; i < 10; i++) {
final int f = i;
appender.writeDocument(w -> {
w.getValueOut().int64(System.currentTimeMillis());
w.getValueOut().object(new MarketData());
});
DSUtil.sleep(100);
}
}
// }).start();
// }
}
开发者ID:danielshaya,项目名称:reactivejournal,代码行数:19,代码来源:QueuePlayGround.java
示例2: writeToQueue
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void writeToQueue() {
//for(int t=0; t<5; t++) {
// new Thread(() -> {
try (ChronicleQueue queue = SingleChronicleQueueBuilder.binary(file).build()) {
final ExcerptAppender appender = queue.acquireAppender();
for (int i = 0; i < 10; i++) {
final int f = i;
appender.writeDocument(w -> {
w.getValueOut().int64(System.currentTimeMillis());
w.getValueOut().object(new MarketData());
});
DSUtil.sleep(100);
}
}
// }).start();
// }
}
开发者ID:danielshaya,项目名称:reactivejournal,代码行数:19,代码来源:QueuePlayGround.java
示例3: readFromQueue
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void readFromQueue(){
ChronicleQueue queue = SingleChronicleQueueBuilder.binary(file).build();
final ExcerptTailer tailer = queue.createTailer();
//System.out.println(queue.dump());
Executors.newSingleThreadExecutor().submit(()-> {
while (true) {
tailer.readDocument(w -> {
ValueIn in = w.getValueIn();
long time = in.int64();
String filter = in.text();
MarketData trade = in.object(new MarketData(), MarketData.class);
System.out.println(time + "->" + trade);
});
}
});
}
开发者ID:danielshaya,项目名称:reactivejournal,代码行数:20,代码来源:QueuePlayGround.java
示例4: ChronicleQueue4x
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public ChronicleQueue4x() throws IOException {
FileUtil.deleteTmpDirFilesMatching("chronicle-queue4x");
final File basePath = FileUtil.tmpDirFile("chronicle-queue4x");
this.queue = SingleChronicleQueueBuilder
.binary(basePath.getPath())
.wireType(WireType.FIELDLESS_BINARY)
.blockSize(128 << 20)
.build();
// this.queue = ChronicleQueueBuilder
// .single(basePath.getPath())
// .wireType(WireType.FIELDLESS_BINARY)
// .blockSize(128 << 20)
// .build();
this.appender = queue.acquireAppender();
this.tailer = queue.createTailer();
}
开发者ID:terzerm,项目名称:fx-highway,代码行数:18,代码来源:ChronicleQueue4x.java
示例5: setup
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
@Setup
public void setup() {
String target = OS.TMP;
upQueuePath = new File(target, "ComponentsBenchmark-up-" + System.nanoTime());
upQueue = SingleChronicleQueueBuilder.binary(upQueuePath).build();
smdWriter = upQueue.acquireAppender().methodWriter(SidedMarketDataListener.class);
downQueuePath = new File(target, "ComponentsBenchmark-down-" + System.nanoTime());
downQueue = SingleChronicleQueueBuilder.binary(downQueuePath).build();
MarketDataListener mdWriter = downQueue.acquireAppender().methodWriter(MarketDataListener.class);
SidedMarketDataCombiner combiner = new SidedMarketDataCombiner(mdWriter);
reader = upQueue.createTailer().methodReader(combiner);
System.out.println("up-q " + upQueuePath);
}
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:17,代码来源:ComponentsBenchmark.java
示例6: CQ4GenFromTestData
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
/**
* Creates a new CQ4GenFromTestData
* @param queueDir The directory where the chronicle queue will go
* @param dataDir The directory where the test data files reside
*/
public CQ4GenFromTestData(final File queueDir, final File dataDir) {
if(queueDir.isDirectory()) {
Arrays.stream(queueDir.listFiles()).forEach(f -> f.delete());
} else {
if(!queueDir.mkdirs()) {
throw new RuntimeException("Failed to create Queue Directory [" + queueDir + "]");
}
}
this.queueDir = queueDir;
this.dataDir = dataDir;
outQueue = SingleChronicleQueueBuilder.binary(queueDir)
.rollCycle(RollCycles.HOURLY)
.wireType(WireType.BINARY)
.build();
}
开发者ID:nickman,项目名称:HeliosStreams,代码行数:21,代码来源:CQ4GenFromTestData.java
示例7: main
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
String pathfr = "queue-fr";
SingleChronicleQueue queuefr = SingleChronicleQueueBuilder.binary(pathfr).build();
MessageConsumer messageConsumer = queuefr.acquireAppender().methodWriter(MessageConsumer.class);
MessageConsumer simpleTranslator = new SimpleTranslator(messageConsumer);
String path_en = "queue-en";
SingleChronicleQueue queue_en = SingleChronicleQueueBuilder.binary(path_en).build();
MethodReader methodReader = queue_en.createTailer().methodReader(simpleTranslator);
while (true) {
if (!methodReader.readOne())
Thread.sleep(10);
}
}
开发者ID:OpenHFT,项目名称:Chronicle-Queue-Sample,代码行数:17,代码来源:TranslatorMain.java
示例8: createQueue
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
ChronicleQueue createQueue(){
int blockSize = Integer.getInteger("chronicle.queueBlockSize", -1);
ChronicleQueue queue = null;
if(blockSize==-1) {
queue = SingleChronicleQueueBuilder.binary(dir).build();
}else {
queue = SingleChronicleQueueBuilder.binary(dir).blockSize(blockSize).build();
}
return queue;
}
开发者ID:danielshaya,项目名称:reactivejournal,代码行数:11,代码来源:ReactiveJournal.java
示例9: main
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void main(String... args) {
String input = args.length > 0 ? args[0] : OS.TMP + "/input";
String output = args.length > 1 ? args[1] : OS.TMP + "/output";
try (ChronicleQueue inputQ = SingleChronicleQueueBuilder.binary(input).build();
ChronicleQueue outputQ = SingleChronicleQueueBuilder.binary(output).build()) {
System.out.println(inputQ.dump());
System.out.println(outputQ.dump());
}
}
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:10,代码来源:HelloWorldDumpMain.java
示例10: main
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void main(String[] args) {
String input = args.length > 0 ? args[0] : OS.TMP + "/input";
String output = args.length > 1 ? args[1] : OS.TMP + "/output";
AtomicLong lastUpdate = new AtomicLong(System.currentTimeMillis() + 1000);
Thread thread = new Thread(() -> {
ChronicleQueue outputQ = SingleChronicleQueueBuilder.binary(output).build();
MethodReader reader = outputQ.createTailer().methodReader((HelloReplier) err::println);
while (!Thread.interrupted()) {
if (reader.readOne()) {
lastUpdate.set(System.currentTimeMillis());
} else {
Jvm.pause(10);
}
}
});
thread.setDaemon(true);
thread.start();
ChronicleQueue inputQ = SingleChronicleQueueBuilder.binary(input).build();
HelloWorld helloWorld = inputQ.createAppender().methodWriter(HelloWorld.class);
Scanner scanner = new Scanner(System.in);
while (true) {
while (System.currentTimeMillis() < lastUpdate.get() + 30)
Thread.yield();
out.print("Chat ");
out.flush();
if (!scanner.hasNextLine())
break;
String line = scanner.nextLine();
helloWorld.hello(line);
lastUpdate.set(System.currentTimeMillis());
}
out.print("Bye");
}
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:38,代码来源:HelloWorldClientMain.java
示例11: ServiceWrapper
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public ServiceWrapper(String inputPath, String outputPath, I serviceImpl) {
Class outClass = ObjectUtils.getTypeFor(serviceImpl.getClass(), ServiceHandler.class);
outputQueue = SingleChronicleQueueBuilder.binary(outputPath).build();
serviceOut = outputQueue.createAppender().methodWriter(outClass);
serviceImpl.init(serviceOut);
inputQueue = SingleChronicleQueueBuilder.binary(inputPath).build();
serviceIn = inputQueue.createTailer().methodReader(serviceImpl);
thread = new Thread(this, new File(inputPath).getName() + " to " + new File(outputPath).getName());
thread.setDaemon(true);
thread.start();
}
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:15,代码来源:ServiceWrapper.java
示例12: init
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
@Override
public void init(JLBH jlbh) {
serviceIn = SingleChronicleQueueBuilder.binary(queueIn).build().createAppender().methodWriter(Service.class);
service2 = new ServiceWrapper<>(queueIn, queue2, new ServiceImpl(jlbh.addProbe("Service 2")));
service3 = new ServiceWrapper<>(queue2, queue3, new ServiceImpl(jlbh.addProbe("Service 3")));
serviceOut = new ServiceWrapper<>(queue3, queueOut, new ServiceImpl(jlbh.addProbe("Service Out"), jlbh));
}
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:8,代码来源:MultiThreadedMain.java
示例13: main
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
String path = "queue-fr";
SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(path).build();
MessageConsumer messagePrinter = System.out::println;
MethodReader methodReader = queue.createTailer().methodReader(messagePrinter);
while (true) {
if (!methodReader.readOne())
Thread.sleep(10);
}
}
开发者ID:OpenHFT,项目名称:Chronicle-Queue-Sample,代码行数:12,代码来源:OutputMain.java
示例14: main
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void main(String[] args) {
String path_en = "queue-en";
SingleChronicleQueue queue_en = SingleChronicleQueueBuilder.binary(path_en).build();
MessageConsumer messageConsumer = queue_en.acquireAppender().methodWriter(MessageConsumer.class);
Scanner read = new Scanner(System.in);
while (true) {
System.out.println("type something");
String line = read.nextLine();
if (line.isEmpty())
break;
messageConsumer.onMessage(line);
}
System.out.println("... bye.");
}
开发者ID:OpenHFT,项目名称:Chronicle-Queue-Sample,代码行数:15,代码来源:InputMain.java
示例15: main
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void main(String[] args) {
String path = "queue";
SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(path).build();
ExcerptTailer tailer = queue.createTailer();
while (true) {
String text = tailer.readText();
if (text == null)
Jvm.pause(10);
else
System.out.println(text);
}
}
开发者ID:OpenHFT,项目名称:Chronicle-Queue-Sample,代码行数:15,代码来源:OutputMain.java
示例16: main
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void main(String[] args) {
String path = "queue";
SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(path).build();
ExcerptAppender appender = queue.acquireAppender();
Scanner read = new Scanner(System.in);
while (true) {
System.out.println("type something");
String line = read.nextLine();
if (line.isEmpty())
break;
appender.writeText(line);
}
System.out.println("... bye.");
}
开发者ID:OpenHFT,项目名称:Chronicle-Queue-Sample,代码行数:15,代码来源:InputMain.java
示例17: dumpQueue
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public static void dumpQueue(){
try(ChronicleQueue queue = SingleChronicleQueueBuilder.binary(file).build()){
System.out.println(queue.dump());
}
}
开发者ID:danielshaya,项目名称:reactivejournal,代码行数:7,代码来源:QueuePlayGround.java
示例18: ChronicleTransactionStore
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
ChronicleTransactionStore(Path transactionDir) {
ChronicleQueue chronicleQueue = SingleChronicleQueueBuilder.binary(transactionDir).build();
m_appender = chronicleQueue.acquireAppender();
m_tailer = chronicleQueue.createTailer();
}
开发者ID:Axway,项目名称:iron,代码行数:6,代码来源:ChronicleTransactionStore.java
示例19: run
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
private void run() {
// start a timer to monitor events / second
AtomicLong numEvents = new AtomicLong(0L);
timeline.getScheduler().schedule(() -> {
LOG.info("processed " + (numEvents.get() / 15) + " events / second");
numEvents.set(0L);
}).repeatIndefinitely(Duration.ofSeconds(15L))
.start();
// start the marketdata subscription
String[] productCodes = {
"BTC/USD",
"ETH/USD",
"LTC/USD",
"ETH/BTC",
"LTC/BTC"
};
for (String productCode : productCodes) {
ProductId product = new ProductId("urn:gsid:product:" + productCode);
mdClientFuture.thenAccept(mdClient -> {
try {
Signal<OrderBookEvent> events = mdClient.subscribeOrderBookEvents(product);
timeline.onSignal(events)
.map(event -> numEvents.incrementAndGet())
.bind();
RecordContext ctx = new InMemoryRecordContext();
String queuePath = "orderEvents" + File.separator + productCode.replace('/', '-');
try (ChronicleQueue queue = SingleChronicleQueueBuilder.binary(queuePath).build()) {
timeline.bind(events, event -> {
OrderBookEvent orderEvent = events.getValue();
ExcerptAppender appender = queue.acquireAppender();
appender.writeDocument(w -> w.write("orderEvent")
.marshallable(m -> m.write("eventTypeCode")
.int8(orderEvent.getEventType().getCode())
.write("product").text(product.getCode())
.write("eventData").bytes(orderEvent.encodeRecord(ctx))));
});
}
} catch (GeneralSecurityException | IOException | URISyntaxException e) {
LOG.error("failed to subscribe to OrderBookEvents", e);
}
});
}
}
开发者ID:cloudwall,项目名称:libcwfincore,代码行数:46,代码来源:MarketdataCaptureTool.java
示例20: MarketdataReplayer
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder; //导入依赖的package包/类
public MarketdataReplayer(File captureFile) {
Preconditions.checkArgument(captureFile.exists(), "cannot create replayer -- file does not exist");
queue = SingleChronicleQueueBuilder.binary(captureFile).build();
tailer = queue.createTailer().toStart();
}
开发者ID:cloudwall,项目名称:libcwfincore,代码行数:6,代码来源:MarketdataReplayer.java
注:本文中的net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论