In Redis pub/sub if something is published when there is no subscriber, data is kind of lost.
What i wanted is kind of notification to publisher when subscriber is subscribed.
One way could be keep publishing in a loop and break the loop when publisher find at least one subscriber. But i don't think thats a good way. (Also i can't keep exponential back off).
while(1) {
$numOfSubscriber = $redis->publish($channel1, $encodePublish);
if($numOfSubscriber > 0)
break;
}
Is there any better way to solve the same issue?
I am using Predis.