Class PubSubReceiver
Defined in File pubsub_receiver.hpp
Base Type
public holoscan::Receiver(Class Receiver)
-
class PubSubReceiver : public holoscan::Receiver
Pub/Sub receiver class for topic-based subscriptions.
PubSubReceiver is used to receive messages from publishers on a specific topic. It wraps the GXF
nvidia::gxf::PubSubReceivercomponent, which is backend-agnostic and works with different transport implementations (gRPC+UCX, DDS, etc.).Public Functions
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Resource, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>
inline explicit PubSubReceiver(ArgT &&arg, ArgsT&&... args)
-
PubSubReceiver() = default
-
PubSubReceiver(const std::string &name, nvidia::gxf::PubSubReceiver *component)
-
inline virtual const char *gxf_typename() const override
-
virtual void setup(ComponentSpec &spec) override
Define the resource specification.
- Parameters
spec – The reference to the component specification.
-
virtual void initialize() override
Initialize the component.
This method is called only once when the component is created for the first time, and use of light-weight initialization.
-
nvidia::gxf::PubSubReceiver *get() const
Get the underlying GXF PubSubReceiver component.
- Returns
Pointer to the GXF PubSubReceiver, or nullptr if not initialized.
-
std::string topic_name() const
Get the topic name this receiver subscribes to.
- Returns
The topic name string.
-
size_t matched_publisher_count() const
Get the number of matched publishers.
- Returns
Number of publishers currently matched to this subscriber.
-
bool has_matched_publishers() const
Check if there are any matched publishers.
- Returns
true if at least one publisher is matched.
-
std::vector<nvidia::gxf::PublisherGid> matched_publisher_gids() const
Get the GIDs of all currently matched publishers.
- Returns
Snapshot vector of publisher GIDs (taken under lock).
-
void qos(const nvidia::gxf::QoSProfile &qos)
Set the QoS profile for this receiver.
Must be called before initialize(). The profile is forwarded to the underlying GXF PubSubReceiver during initialization. If called after initialize(), the update is ignored and a warning is logged. If not set, QoSProfile::Default() is used (best-effort, volatile, keep-last 10).
- Parameters
qos – The QoS profile to apply.
-
inline const std::optional<nvidia::gxf::QoSProfile> &qos() const
Get the QoS profile set on this receiver (if any).
- Returns
The QoS profile, or std::nullopt if none was explicitly set.
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Resource, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>