I am reading a provided Chronicle Queue file via a tailer. Upon creating the tailer I get the warning message:
"reading control code as text"
There seems to be a certain section(s) of the file that causes this warning to be logged. The other records in the file are fine. Is there a way to skip this section of the file or prevent this warning message from being generated due to probably how the file was written? Could this occur if the write version and read version of chronicle-queue are different ?
boolean hasData = true;
while (hasData) {
try (final DocumentContext dc = tailer.readingDocument()) {
if (hasData = dc.isPresent()) {
ValueIn valueIn = dc.wire().read();
System.out.print(valueIn.readLong());
System.out.print(valueIn.text());
System.out.print(valueIn.readInt());
System.out.print(valueIn.readInt());
System.out.println();
}
else{
System.out.println("end of file");
break;
}
}
}
Chronicle Queue: 5.22.18
It means that something was read as text but instead was a random piece of data it didn't expect. If you want a more flexible approach to scheme changes I suggest writing a DTO e.g.
class MyData extends SelfDescribingMarsahallable {
long timestamp;
String text;
int num1, num2;
}
interface IData {
void data(MyData data);
}
IData idata = appender.methodWriter(IData.class);
idata.data(myData);
IData idata2 = d -> System.out.println(d);
MethodReader reader = tailer.methodReader(idata);
while(reader.readOne()) {
// read until empty
}
You can write at the lower level as you have; however, you have to consider handling different message types, versions, and schema changes yourself.