Search code examples
chroniclechronicle-queue

Is it ok for a SingleChronicleQueue tailer handler to append a different message to the same Queue?


I have 1 SingleChronicleQueue that has different messages appended via methodWriter proxy API.

My reader handler processes 'message1' and appends back a different message 'message2' for the same handler to process via a different method (message2()).

Flow is:
    Append: proxy appends message1 to Q
    Tailer: handler1 reads message1 and 
            appends using proxy message2 to same Q
    Tailer: handler1 reads message2

OK?

Or should tailers always write to a different 'Out' queue and have that sit in-between?

Reason for this approach controlling non-locking access to shared state.


Solution

  • The simplest solution is to have one queue for all your events and have reader(s) ignore events they don't care about.

    There can be good reasons to have more queues, however, I would start with one and work your way up from there.

    NOTE: With a single queue, a tailer will see all the messages even the a thread using the tailer wrote.