The current ipc implementation makes it impossible to tunnel all
pubsub messages between two systems because an endpoint would need
to subscribe all topics, including those that will be created after
the endpoint is opened.
This commit allows endpoints to subscribe the topic "*". Subscribers
that subscribe to this topic are called "taps" and receive messages
from all topics.
fi
echo "$subscriber"
- done < <(find "$(ipc_get_root)/pubsub/$topic" -mindepth 1 -maxdepth 1 -type l)
+ done < <(find "$(ipc_get_root)/pubsub/$topic" -mindepth 1 -maxdepth 1 -type l 2>/dev/null)
+
+ return 0
+}
+
+_ipc_endpoint_topic_get_subscribers_and_taps() {
+ local topic="$1"
+
+ {
+ _ipc_endpoint_topic_get_subscribers "$topic"
+ _ipc_endpoint_topic_get_subscribers "*"
+ } | sort | uniq
return 0
}
continue
fi
ipc_endpoint_send "$endpoint" "$subscriber" "$message" "$topic"
- done < <(_ipc_endpoint_topic_get_subscribers "$topic")
+ done < <(_ipc_endpoint_topic_get_subscribers_and_taps "$topic")
return 0
}