0

I am very new to ChronicleQueue and I am unable to find a straight forward example of how can I read back my custom object from a tailer.

public class MyData extends AbstractMarshallable

I have my class containing some strings and numbers, I am able to write to queue using appender, but there is no straight forward api to call. how can i get a object of MyData from tailer.readDocument api?

Sathish Kumar
  • 313
  • 2
  • 15

1 Answers1

1

Try with below code:

final DocumentContext context = queue.createTailer().readingDocument();
final MyData container = new MyData();
if (context.isPresent()) {
    context.wire().getValueIn().marshallable(container);
}

this assumes that appending is performed in the following manner:

try (DocumentContext ctx = appender.writingDocument()) {
    ctx.wire().getValueOut().marshallable(myData);
}
Mark Price
  • 296
  • 1
  • 3