Holoscan SDK v4.0.0

Class PubSubTransmitter

Base Type

class PubSubTransmitter : public holoscan::Transmitter

Pub/Sub transmitter class for topic-based publishing.

PubSubTransmitter is used to emit messages to subscribers on a specific topic. It wraps the GXF nvidia::gxf::PubSubTransmitter component, 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 PubSubTransmitter(ArgT &&arg, ArgsT&&... args)
PubSubTransmitter() = default
PubSubTransmitter(const std::string &name, nvidia::gxf::PubSubTransmitter *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::PubSubTransmitter *get() const

Get the underlying GXF PubSubTransmitter component.

Returns

Pointer to the GXF PubSubTransmitter, or nullptr if not initialized.

std::string topic_name() const

Get the topic name this transmitter publishes to.

Returns

The topic name string.

size_t matched_subscriber_count() const

Get the number of matched subscribers.

Returns

Number of subscribers currently matched to this publisher.

bool has_matched_subscribers() const

Check if there are any matched subscribers.

Returns

true if at least one subscriber is matched.

std::vector<nvidia::gxf::SubscriberGid> matched_subscriber_gids() const

Get the GIDs of all currently matched subscribers.

Returns

Snapshot vector of subscriber GIDs (taken under lock).

void qos(const nvidia::gxf::QoSProfile &qos)

Set the QoS profile for this transmitter.

Must be called before initialize(). The profile is forwarded to the underlying GXF PubSubTransmitter 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 transmitter (if any).

Returns

The QoS profile, or std::nullopt if none was explicitly set.

Previous Class PubSubReceiver
Next Class RealtimeClock
© Copyright 2022-2026, NVIDIA. Last updated on Mar 9, 2026