Chronicle queue events listener

1.6k views Asked by At

1) In chronicle queue v4 most test patterns show some form of DocumentContext.isPresent() busy state checking, when ExcerptTailer is positioned at the end of the queue and code is waiting for new entries to arrive from ExcerptAppender.

2) Is there a built-in chronicle queue mechanism for asynchronous appender -> tailer notifications, such that upon receipt of a notification event, given tailer is guaranteed to have at least one entry posted by appender, ready for read?

3) If not, what is recommended pattern to implement such event listener? Please share a working example?

1

There are 1 answers

6
Peter Lawrey On BEST ANSWER

The recommended pattern for implementing a listener pattern is to use the methodReader/methodWriter which can also take care of timestamps when where you read was up.

I suggest you read these https://vanilla-java.github.io/tag/Microservices/ from the bottom up starting with Part 1.

For the tailer, the only way it know there is a message is by reading/polling the end of the queue. If the appender and tailer are in the same process you can use a different mechanism of your choice.