RTI Connext Java API Version 7.1.0

Specifies how RTI Connext sends application data on the network. This QoS policy can be used to tell RTI Connext to use its own thread to send data, instead of the user thread. More...

Inheritance diagram for PublishModeQosPolicy:
QosPolicy PublicationPriority

Public Attributes

PublishModeQosPolicyKind kind
 Publishing mode. More...
String flow_controller_name
 Name of the associated flow controller. More...
int priority = UNDEFINED
 Publication priority. More...
- Public Attributes inherited from QosPolicy
final QosPolicyId_t id
 The ID of this QoS policy. More...
final String policy_name
 The name of this QoS policy. More...

Additional Inherited Members

- Static Public Attributes inherited from PublicationPriority
static final int UNDEFINED
 Initializer value for com.rti.dds.infrastructure.PublishModeQosPolicy.priority and/or com.rti.dds.infrastructure.ChannelSettings_t.priority. More...
static final int AUTOMATIC
 Constant value for com.rti.dds.infrastructure.PublishModeQosPolicy.priority and/or com.rti.dds.infrastructure.ChannelSettings_t.priority. More...

Detailed Description

Specifies how RTI Connext sends application data on the network. This QoS policy can be used to tell RTI Connext to use its own thread to send data, instead of the user thread.

The publishing mode of a com.rti.dds.publication.DataWriter determines whether data is written synchronously in the context of the user thread when calling com.rti.ndds.example.FooDataWriter.write or asynchronously in the context of a separate thread internal to the middleware.

Each com.rti.dds.publication.Publisher spawns a single asynchronous publishing thread (com.rti.dds.infrastructure.AsynchronousPublisherQosPolicy.thread) to serve all its asynchronous com.rti.dds.publication.DataWriter instances.

See also
RxO = N/A
Changeable = NO


The fastest way for RTI Connext to send data is for the user thread to execute the middleware code that actually sends the data itself. However, there are times when user applications may need or want an internal middleware thread to send the data instead. For instance, to send large data reliably, you must use an asynchronous thread.

When data is written asynchronously, a com.rti.dds.publication.FlowController, identified by flow_controller_name, can be used to shape the network traffic. Shaping a data flow usually means limiting the maximum data rates at which the middleware will send data for a com.rti.dds.publication.DataWriter. The flow controller will buffer any excess data and only send it when the send rate drops below the maximum rate. The flow controller's properties determine when the asynchronous publishing thread is allowed to send data and how much.

Asynchronous publishing may increase latency, but offers the following advantages:

  • The com.rti.ndds.example.FooDataWriter.write call does not make any network calls and is therefore faster and more deterministic. This becomes important when the user thread is executing time-critical code.
  • When data is written in bursts or when sending large data types as multiple fragments, a flow controller can throttle the send rate of the asynchronous publishing thread to avoid flooding the network.
  • Asynchronously written samples for the same destination will be coalesced into a single network packet which reduces bandwidth consumption.

The maximum number of samples that will be coalesced depends on com.rti.ndds.transport.Transport.Property_t.gather_send_buffer_count_max (each sample requires at least 2-4 gather-send buffers). Performance can be improved by increasing com.rti.ndds.transport.Transport.Property_t.gather_send_buffer_count_max. Note that the maximum value is operating system dependent.

The middleware must queue samples until they can be sent by the asynchronous publishing thread (as determined by the corresponding com.rti.dds.publication.FlowController). The number of samples that will be queued is determined by the com.rti.dds.infrastructure.HistoryQosPolicy. When using com.rti.dds.infrastructure.HistoryQosPolicyKind.HistoryQosPolicyKind.KEEP_LAST_HISTORY_QOS, only the most recent com.rti.dds.infrastructure.HistoryQosPolicy.depth samples are kept in the queue. Once unsent samples are removed from the queue, they are no longer available to the asynchronous publishing thread and will therefore never be sent.

Member Data Documentation

◆ kind

Publishing mode.

[default] com.rti.dds.infrastructure.PublishModeQosPolicyKind.PublishModeQosPolicyKind.SYNCHRONOUS_PUBLISH_MODE_QOS

◆ flow_controller_name

◆ priority

int priority = UNDEFINED

Publication priority.

A positive integer value designating the relative priority of the com.rti.dds.publication.DataWriter, used to determine the transmission order of pending writes.

Use of publication priorities requires the asynchronous publisher (com.rti.dds.infrastructure.PublishModeQosPolicyKind.PublishModeQosPolicyKind.ASYNCHRONOUS_PUBLISH_MODE_QOS) with com.rti.dds.publication.FlowControllerProperty_t.scheduling_policy set to com.rti.dds.publication.FlowControllerSchedulingPolicy.FlowControllerSchedulingPolicy.HPF_FLOW_CONTROLLER_SCHED_POLICY.

Larger numbers have higher priority.

For multi-channel DataWriters, if the publication priority of any channel is set to any value other than com.rti.dds.infrastructure.PUBLICATION_PRIORITY_UNDEFINED, then the channel's priority will take precedence over that of the DataWriter.

For multi-channel DataWriters, if the publication priority of any channel is com.rti.dds.infrastructure.PUBLICATION_PRIORITY_UNDEFINED, then the channel will inherit the publication priority of the DataWriter.

If the publicaton priority of the DataWriter, and of any channel of a multi-channel DataWriter, are com.rti.dds.infrastructure.PUBLICATION_PRIORITY_UNDEFINED, then the priority of the DataWriter or DataWriter channel will be assigned the lowest priority value.

If the publication priority of the DataWriter is com.rti.dds.infrastructure.PUBLICATION_PRIORITY_AUTOMATIC, then the DataWriter will be assigned the priority of the largest publication priority of all samples in the DataWriter.

The publication priority of each sample can be set in the com.rti.dds.infrastructure.WriteParams_t of the com.rti.ndds.example.FooDataWriter.write_w_params function.

For dispose and unregister samples, use the com.rti.dds.infrastructure.WriteParams_t of com.rti.ndds.example.FooDataWriter.dispose_w_params and com.rti.ndds.example.FooDataWriter.unregister_instance_w_params.

[default] com.rti.dds.infrastructure.PUBLICATION_PRIORITY_UNDEFINED

[range] [-1, MAX_INT]