This message was deleted.
# general
s
This message was deleted.
đź‘€ 2
a
There is a non-persistent topic. It’s effectively a channel. Once you produce a message, it immediately dispatch it to an existing consumer based on the subscription type.
If there are no consumers, it is discarded.
s
But I should do other operation based on existence of consumer before publishing message. For example, if consumer exists first deduct balance of user before publishing message, in non-persistent case only consumer non-existence only after publishing message.
m
You can use PulsarAdmin to check for active subscriptions. Nevertheless I think that the requirement is problematic: • What if theres is a consumer, but is not processing messages, or processing messages at a very low rate. It’s logically equal to disconnected consumer • What if you detect the consumer, start to publish, and then the consumer gets disconnected (like network error). There are still messages that will be written to the topic, because there will be a delay between the check and stopping of producing. There is no “immediate” detection possible as far as I know
a
@Michał Cukierman is right. Something seems very fishy about the architecture/requirements you’re describing.