用 pulsar 创建很多主题是不是一个好的场景?

Is creating a lot of topics with pulsar is a good scenario?

使用 Pulsar 为每个散列动态创建一个主题(或分区),并在不再使用主题(或分区)时删除主题(或分区)是否可能和好的场景?

我们的想法是能够以有序的方式读取具有相同哈希值的数据,而不会在具有相同哈希值的两条消息之间出现具有另一个哈希值的消息。允许客户在内存中保留有限数量的聚合消息。

消费者还应该能够在开始消费另一个主题(或分区)之前完全消费一个主题(或分区)。

因此,目标是能够以不同的顺序使用和生成数据。

produce  in this order          and read like this
1 2 3 4 5 
_ _ _ _ _
a b c d e                       1 [a b c d e] 
a b c d e                       2 [a b c d e]
a b c d e     -------->         3 [a b c d e]
z y x w v                       4 [z y x w v]
g h i j k                       5 [g h i j k]
_ _ _ _ _

在此示例中,消息密钥哈希当然没有显示(每行具有相同的密钥哈希)

Is that possible and good scenario with pulsar to create a topic ( or a partition ) for each hash on the fly, and delete the topics (or partition ) when it is no more used?

当然,与其他消息系统相比,在 Pulsar 中创建许多主题的操作要便宜得多。主题可以被显式删除,或者当所有生产者和消费者断开连接并且该主题的所有订阅也被删除时,它们会自动删除。

The consumer should also be able to consume totally one topic (or partition) before starting to consume another one.

如果每个 key 使用 1 个主题,那么在消费者方面,您可以灵活地决定如何使用消息。

您唯一需要确保的是在发布消息之前创建所有主题的订阅,以便 Pulsar 保留数据。