use of net.openhft.chronicle.queue.ChronicleQueue in project Chronicle-Queue by OpenHFT.
the class SingleChronicleQueueTest method testSingleWire.
// *************************************************************************
//
// *************************************************************************
@Test
public void testSingleWire() {
final File file = createTempFile("testSingleWire");
try {
final ChronicleQueue chronicle = createQueue(file);
final ExcerptAppender appender = chronicle.acquireAppender();
appender.writeDocument(wire -> wire.write(() -> "FirstName").text("Steve"));
appender.writeDocument(wire -> wire.write(() -> "Surname").text("Jobs"));
StringBuilder first = new StringBuilder();
StringBuilder surname = new StringBuilder();
final ExcerptTailer tailer = chronicle.createTailer();
tailer.readDocument(wire -> wire.read(() -> "FirstName").text(first));
tailer.readDocument(wire -> wire.read(() -> "Surname").text(surname));
Assert.assertEquals("Steve Jobs", first + " " + surname);
} finally {
file.delete();
}
}
Aggregations