Regarding sub-topics in chronicle queue

孤人 提交于 2020-06-01 05:52:20

问题


I'm looking to write messages to a single queue. I'd like to use the sub-topics functionality, so that tailers can pick and choose either to read all of the sub-topics under one topic, or pick specific sub-topics to read from.

The documentation mentions that sub-topics are supported in a directory under the main topic, so in order to read from a subtopic, do we just create a new queue and point it to the sub-topic path?

    SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary("Topic").build();
    SingleChronicleQueue queue2 = SingleChronicleQueueBuilder.binary("Topic/SubTopic").build();

    ExcerptAppender appender = queue.acquireAppender();
    ExcerptAppender appender2 = queue2.acquireAppender();

    appender.writeText("aaa");
    appender2.writeText("bbb");

This will just output aaa, but i want it to output but aaa and bbb


回答1:


There is no real concept of hierarchy in Chronicle-Queue; there is a one-to-one mapping between file-system directory and queue.

If you wish to filter certain records, you will need to do that when reading the records out of the queue. It will be up to your application to decide how to detect messages that should be filtered.

The documentation you refer to appears to have been copied from concepts that exist in Chronicle-Engine.



来源:https://stackoverflow.com/questions/47659453/regarding-sub-topics-in-chronicle-queue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!