|Publishing mode. |
|Name of the associated flow controller. |
|Publication priority. |
The publishing mode of a DDSDataWriter determines whether data is written synchronously in the context of the user thread when calling FooDataWriter::write or asynchronously in the context of a separate thread internal to the middleware.
Each DDSPublisher spawns a single asynchronous publishing thread (DDS_AsynchronousPublisherQosPolicy::thread) to serve all its asynchronous DDSDataWriter instances.
When data is written asynchronously, a DDSFlowController, 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 DDSDataWriter. 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 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 NDDS_Transport_Property_t::gather_send_buffer_count_max (each sample requires at least 2-4 gather-send buffers). Performance can be improved by increasing NDDS_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 DDSFlowController). The number of samples that will be queued is determined by the DDS_HistoryQosPolicy. When using DDS_KEEP_LAST_HISTORY_QOS, only the most recent DDS_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.
Name of the associated flow controller.
NULL value or zero-length string refers to DDS_DEFAULT_FLOW_CONTROLLER_NAME.
flow_controller_name points to a built-in flow controller, finalizing the DDS_DataWriterQos will also free the string pointed to by
flow_controller_name. Therefore, use DDS_String_dup before passing the string to
flow_controller_name, or reset
flow_controller_name to NULL before finalizing the QoS.
Please refer to Conventions for more information.
A positive integer value designating the relative priority of the DDSDataWriter, used to determine the transmission order of pending writes.
Use of publication priorities requires the asynchronous publisher (DDS_ASYNCHRONOUS_PUBLISH_MODE_QOS) with DDS_FlowControllerProperty_t::scheduling_policy set to DDS_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 DDS_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 DDS_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 DDS_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 DDS_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 DDS_WriteParams of the FooDataWriter::write_w_params function.
For dispose and unregister samples, use the DDS_WriteParams of FooDataWriter::dispose_w_params and FooDataWriter::unregister_instance_w_params.