For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • Introduction
    • Overview
    • Relevant Technologies
    • Getting Started
  • Setup
    • SDK Installation
    • Additional Setup
    • Third Party Hardware Setup
  • Using the SDK
    • Holoscan Core
    • GPU Resident Execution
    • Holoscan by Example
    • Create an Application
    • Create a Distributed Application
    • Create an Operator
    • Create an Operator via Decorator
    • Create a Condition
    • Dynamic Flow Control
    • CUDA Stream Handling
    • Logging
    • Data Logging
    • Debugging
    • Python Operator Bindings
  • Operators
    • Operators and Extensions
    • Visualization
    • Inference
    • Testing
    • Video I/O Vendor Implementation Guide
  • Components
    • Schedulers
    • Conditions
    • Resources
    • Analytics
  • AI Skills
    • Ai Skills
  • API reference
          • Allocator
          • AnnotatedDoubleBufferReceiver
          • AnnotatedDoubleBufferTransmitter
          • AppDriver
          • Application
          • AppWorker
          • Arg
          • ArgList
          • ArgType
          • ArgumentSetter
          • AsyncBufferReceiver
          • AsyncBufferTransmitter
          • AsyncDataLoggerBackend
          • AsyncDataLoggerResource
          • AsynchronousCondition
          • BlockMemoryPool
          • BooleanCondition
          • CLIParser
          • Clock
          • ClockInterface
          • CodecRegistry
          • Component
          • ComponentBase
          • ComponentSpec
          • Condition
          • ConditionCombiner
          • Config
          • CountCondition
          • CPUResourceMonitor
          • CPUThread
          • CsvDataExporter
          • CudaAllocator
          • CudaBufferAvailableCondition
          • CudaContextScopedPush
          • CudaEventCondition
          • CudaFunctionLauncher
          • CudaGreenContext
          • CudaGreenContextPool
          • CudaObjectHandler
          • CudaStreamCondition
          • CudaStreamHandler
          • CudaStreamPool
          • DataExporter
          • DataFlowTracker
          • DataLogger
          • DataLoggerQueue
          • DataLoggerResource
          • DefaultFragmentService
          • DFFTCollector
          • DistributedAppService
          • DLManagedMemoryBufferVersioned
          • DoubleBufferReceiver
          • DoubleBufferTransmitter
          • DownstreamMessageAffordableCondition
          • Endpoint
          • EventBasedScheduler
          • ExecutionContext
          • Executor
          • ExpiringMessageAvailableCondition
          • ExtensionManager
          • FastDdsDiscovery
          • FastDdsEndpoint
          • FastDdsHoloscanEntityTypeSupport
          • FastDdsNativeBufferAdapter
          • FastDdsPubSubContext
          • FastDdsPubSubNetworkContext
          • FastDdsSerializer
          • FastDdsTransport
          • FileFIFOMutex
          • FirstFitAllocator
          • FirstFitAllocatorBase
          • FirstPixelOutCondition
          • FlowGraph
          • FlowGraphImpl
          • Fragment
          • FragmentAllocationStrategy
          • FragmentScheduler
          • FragmentService
          • FragmentServiceProvider
          • GPUDevice
          • GPUResidentDeck
          • GPUResidentExecutor
          • GPUResidentOperator
          • GPUResourceMonitor
          • GreedyFragmentAllocationStrategy
          • GreedyScheduler
          • GXFComponentResource
          • HoloEntitySerializerBase
          • HoloIpcCudaNativeBufferAdapterBase
          • HoloscanAsyncBufferReceiver
          • HoloscanAsyncBufferTransmitter
          • HoloscanLogger
          • HoloscanUcxReceiver
          • HoloscanUcxTransmitter
          • InMemoryPubSubNetworkContext
          • InMemoryPubSubSession
          • InputContext
          • IOSpec
          • LockFreeQueue
          • Logger
          • ManualClock
          • Map
          • MatXAllocator
          • MemoryAvailableCondition
          • Message
          • MessageAvailableCondition
          • MessageLabel
          • MetadataDictionary
          • MetaParameter
          • MultiMessageAvailableCondition
          • MultiMessageAvailableTimeoutCondition
          • MultiThreadScheduler
          • NativeBufferProtocolAdapter
          • NetworkContext
          • Nullable
          • Operator
          • OperatorSpec
          • OrConditionCombiner
          • OrderedQueue
          • OutputContext
          • ParameterWrapper
          • PathMetrics
          • PeriodicCondition
          • PoseTree
          • PoseTreeEdgeHistory
          • PoseTreeManager
          • PoseTreeUCXClient
          • PoseTreeUCXServer
          • PresentDoneCondition
          • PublisherAvailableCondition
          • PubSubContext
          • PubSubReceiver
          • PubSubTransmitter
          • RealtimeClock
          • Receiver
          • Resource
          • RMMAllocator
          • RuntimeError
          • Scheduler
          • ScopedFlock
          • ScopedWaitedFlock
          • SerializationBuffer
          • SessionDiscoveryFrontend
          • SessionTransportFrontend
          • SidecarDispatchQueue
          • SignalHandler
          • SO2
          • SO3
          • StdComponentSerializer
          • StdEntitySerializer
          • StdPubSubEntitySerializer
          • StreamOrderedAllocator
          • Subgraph
          • SubscriberAvailableCondition
          • SyntheticClock
          • SystemResourceManager
          • Tensor
          • TensorMap
          • ThreadPool
          • Timer
          • Topology
          • Transmitter
          • UcxComponentSerializer
          • UcxContext
          • UcxEntitySerializer
          • UcxHoloscanComponentSerializer
          • UcxReceiver
          • UcxSerializationBuffer
          • UcxTransmitter
          • UnboundedAllocator
  • Performance
    • Performance Considerations
    • Flow Tracking
    • GXF Job Statistics
    • Nsight Profiling
  • HoloHub
    • HoloHub Overview
  • FAQ
    • FAQ
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogoDocumentation
On this page
  • Constructors
  • InMemoryPubSubSession
  • Destructor
  • ~InMemoryPubSubSession
  • Methods
  • create_frontends
  • join
  • leave
  • is_multi_context
  • session_id
  • ensure_backends
  • retain_participant
  • release_participant
  • replay_existing_publishers
  • replay_existing_subscribers
  • announce_publisher
  • announce_subscriber
  • remove_publisher
  • remove_subscriber
  • query_publishers
  • query_subscribers
  • get_all_topics
  • wait_for_subscribers
  • send
  • send_queue_size
  • discovery
  • transport
  • snapshot_participants
  • cleanup_expired_participants_locked
  • reset_locked
  • notify_publisher_discovered
  • notify_subscriber_discovered
  • notify_publisher_lost
  • notify_subscriber_lost
  • make_receive_callback
  • registry
  • Static methods
  • get_or_create
  • reset_all_for_testing
  • Member variables
  • Inner classes
  • Frontends
API referenceC++ APIHoloscanClasses

holoscan::InMemoryPubSubSession

Beta
||View as Markdown|
Previous

holoscan::InMemoryPubSubNetworkContext

Next

holoscan::InputContext

Process-global shared state for a group of in-memory pub/sub participants.

InMemoryPubSubSession consolidates the SharedInMemoryPubSubBackend and SharedInMemoryPubSubSession into a single, reusable class. It owns a shared InMemoryDiscovery and InMemoryTransport, and provides per-participant discovery/transport frontends that multiplex callbacks so that each PubSubContext’s init_context() wiring is independent. This was implemented to enable test cases that involve launching multiple GXF contexts from the same process.

#include <holoscan/in_memory_pubsub_session.hpp>

Inherits from: std::enable_shared_from_this< InMemoryPubSubSession > (public)


Constructors

InMemoryPubSubSession

holoscan::InMemoryPubSubSession::InMemoryPubSubSession(holoscan::InMemoryPubSubSession::InMemoryPubSubSession(
const std::string &session_id
)

Destructor

~InMemoryPubSubSession

holoscan::InMemoryPubSubSession::~InMemoryPubSubSession()holoscan::InMemoryPubSubSession::~InMemoryPubSubSession()

Methods

create_frontends

Frontends holoscan::InMemoryPubSubSession::create_frontends()Frontends holoscan::InMemoryPubSubSession::create_frontends()

join

void holoscan::InMemoryPubSubSession::join(
gxf_context_t context
)

Join this session from a specific GXF context.

leave

void holoscan::InMemoryPubSubSession::leave(
gxf_context_t context
)

Leave this session from a specific GXF context.

is_multi_context

bool holoscan::InMemoryPubSubSession::is_multi_context() const

Returns true if more than one distinct GXF context has joined.

session_id

const std::string & holoscan::InMemoryPubSubSession::session_id() const

ensure_backends

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::ensure_backends()

retain_participant

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::retain_participant(
const std::shared_ptr<InMemorySessionParticipant> &participant
)

release_participant

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::release_participant(
const std::shared_ptr<InMemorySessionParticipant> &participant
)

replay_existing_publishers

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::replay_existing_publishers(
const std::shared_ptr<InMemorySessionParticipant> &participant
) const

replay_existing_subscribers

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::replay_existing_subscribers(
const std::shared_ptr<InMemorySessionParticipant> &participant
) const

announce_publisher

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::announce_publisher(
const std::shared_ptr<InMemorySessionParticipant> &participant,
const nvidia::gxf::PublisherInfo &info
)

announce_subscriber

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::announce_subscriber(
const std::shared_ptr<InMemorySessionParticipant> &participant,
const nvidia::gxf::SubscriberInfo &info
)

remove_publisher

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::remove_publisher(
const std::shared_ptr<InMemorySessionParticipant> &participant,
const nvidia::gxf::PublisherGid &gid
)

remove_subscriber

nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::remove_subscriber(
const std::shared_ptr<InMemorySessionParticipant> &participant,
const nvidia::gxf::SubscriberGid &gid
)

query_publishers

nvidia::gxf::Expected<std::vector<nvidia::gxf::PublisherInfo>> holoscan::InMemoryPubSubSession::query_publishers(
const std::string &topic_name
) const

query_subscribers

nvidia::gxf::Expected<std::vector<nvidia::gxf::SubscriberInfo>> holoscan::InMemoryPubSubSession::query_subscribers(
const std::string &topic_name
) const

get_all_topics

nvidia::gxf::Expected<std::vector<std::string>> holoscan::InMemoryPubSubSession::get_all_topics() const

wait_for_subscribers

bool holoscan::InMemoryPubSubSession::wait_for_subscribers(
const std::string &topic_name,
size_t expected_count,
std::chrono::milliseconds timeout
) const

send

Const (1)
Const (2)
nvidia::gxf::Expected<void> holoscan::InMemoryPubSubSession::send(
const nvidia::gxf::Gid &destination_gid,
const std::vector<uint8_t> &payload,
const nvidia::gxf::MessageMetadata &metadata
) const

send_queue_size

size_t holoscan::InMemoryPubSubSession::send_queue_size() const

discovery

std::shared_ptr<nvidia::gxf::InMemoryDiscovery> holoscan::InMemoryPubSubSession::discovery() const

transport

std::shared_ptr<nvidia::gxf::InMemoryTransport> holoscan::InMemoryPubSubSession::transport() const

snapshot_participants

std::vector<std::shared_ptr<InMemorySessionParticipant>> holoscan::InMemoryPubSubSession::snapshot_participants()std::vector<std::shared_ptr<InMemorySessionParticipant>> holoscan::InMemoryPubSubSession::snapshot_participants()

cleanup_expired_participants_locked

void holoscan::InMemoryPubSubSession::cleanup_expired_participants_locked()

reset_locked

void holoscan::InMemoryPubSubSession::reset_locked()

notify_publisher_discovered

void holoscan::InMemoryPubSubSession::notify_publisher_discovered(
const nvidia::gxf::PublisherInfo &info
)

notify_subscriber_discovered

void holoscan::InMemoryPubSubSession::notify_subscriber_discovered(
const nvidia::gxf::SubscriberInfo &info
)

notify_publisher_lost

void holoscan::InMemoryPubSubSession::notify_publisher_lost(
const nvidia::gxf::PublisherGid &gid
)

notify_subscriber_lost

void holoscan::InMemoryPubSubSession::notify_subscriber_lost(
const nvidia::gxf::SubscriberGid &gid
)

make_receive_callback

static nvidia::gxf::PubSubTransport::ReceiveCallback holoscan::InMemoryPubSubSession::make_receive_callback(
const std::shared_ptr<InMemorySessionParticipant> &participant
)

registry

static SessionRegistry & holoscan::InMemoryPubSubSession::registry()

Static methods

get_or_create

static std::shared_ptr<InMemoryPubSubSession> holoscan::InMemoryPubSubSession::get_or_create(static std::shared_ptr<InMemoryPubSubSession> holoscan::InMemoryPubSubSession::get_or_create(
const std::string &session_id
)

Get or create a session by ID.

Thread-safe. Returns the same shared_ptr for the same session_id within the process.

reset_all_for_testing

static void holoscan::InMemoryPubSubSession::reset_all_for_testing()

Release all sessions and reset shared state for tests.

Must only be called when no session frontends are active.


Member variables

NameTypeDescription
session_id_std::string
mutex_std::mutex
subscriber_wait_mutex_std::mutex
subscriber_wait_cv_std::condition_variable
participants_std::unordered_map< uint64_t, std::weak_ptr< InMemorySessionParticipant > >
discovery_std::shared_ptr< nvidia::gxf::InMemoryDiscovery >
transport_std::shared_ptr< nvidia::gxf::InMemoryTransport >
next_participant_id_uint64_t
context_mutex_std::mutex
contexts_std::set< gxf_context_t >

Inner classes

Frontends

struct holoscan::InMemoryPubSubSession::Frontends

Create a paired discovery + transport frontend that share the same participant state.

The discovery and transport frontends must be used together for a single PubSubContext — they share per-participant callback state so that PubSubContext::init_context() wiring is independent per context.

NameTypeDescription
discoverystd::shared_ptr< nvidia::gxf::PubSubDiscovery >
transportstd::shared_ptr< nvidia::gxf::PubSubTransport >