是否可以在 Pulsar 上为同一主题设置多个生产者?
Is it possible to have multiple producers for the same topic on Pulsar?
我知道您可以将主题订阅设置为共享订阅,以允许多个消费者使用同一主题。这也可以为多个生产者完成吗?
出于某种原因,当我尝试时,我得到了 Producer with name '<topic_name>' is already connected to topic
是的,一个主题可以有多个制作人。您只需要确保每个制作人都有一个唯一的名字。来自 Java client API docs 的 ProducerBuilder.producerName
部分:
When specifying a name, it is up to the user to ensure that, for a
given topic, the producer name is unique across all Pulsar's clusters.
Brokers will enforce that only a single producer a given name can be
publishing on a topic.
确保生产者名称唯一的最简单方法是让 Pulsar 自动为您设置。来自同一部分:
If not assigned, the system will generate a globally unique name which
can be accessed with Producer.getProducerName().
我知道您可以将主题订阅设置为共享订阅,以允许多个消费者使用同一主题。这也可以为多个生产者完成吗?
出于某种原因,当我尝试时,我得到了 Producer with name '<topic_name>' is already connected to topic
是的,一个主题可以有多个制作人。您只需要确保每个制作人都有一个唯一的名字。来自 Java client API docs 的 ProducerBuilder.producerName
部分:
When specifying a name, it is up to the user to ensure that, for a given topic, the producer name is unique across all Pulsar's clusters. Brokers will enforce that only a single producer a given name can be publishing on a topic.
确保生产者名称唯一的最简单方法是让 Pulsar 自动为您设置。来自同一部分:
If not assigned, the system will generate a globally unique name which can be accessed with Producer.getProducerName().