RTI Connext .Net APIs
Version 5.2.0
|
Allows you to receive samples from a SharedReaderQueue. More...
Inherits AlreadyDisposedHelper< QueueConsumer< T >>, and IDisposable.
Inherited by RTI.Connext.Queuing.QueueConsumer< T >.EmptyReaderListener, and RTI.Connext.Queuing.QueueConsumer< T >.QueueConsumerReaderListener.
Public Member Functions | |
QueueConsumer (DomainParticipant participant, String queueTopicName, String sharedSubscriber, TypeSupport queueTypeSupport) | |
Creates a QueueConsumer with the minimum set of parameters. | |
QueueConsumer (QueueConsumerParams< T > parameters) | |
Creates a QueueConsumer with parameters. | |
bool | ReceiveSample (Sample< T > sample, Duration_t maxWait) |
Waits for a sample and copies its contents into a Sample. | |
IList< Sample< T > > | ReceiveSamples (IList< Sample< T >> samples, int maxCount, Duration_t maxWait) |
Waits for multiple samples and copies them into a list. | |
IList< Sample< T > > | ReceiveSamples (IList< Sample< T >> samples, int minCount, int maxCount, Duration_t maxWait) |
Waits for multiple samples and copies them into a list. | |
LoanedSamples< T > | ReceiveSamples (Duration_t maxWait) |
Waits for multiple samples and provides a loaned container to access them. | |
LoanedSamples< T > | ReceiveSamples (int minCount, int maxCount, Duration_t maxWait) |
Waits for multiple samples and provides a loaned container to access them. | |
bool | TakeSample (Sample< T > sample) |
Copies the contents of a sample into a Sample. | |
LoanedSamples< T > | TakeSamples () |
Provides a loaned container to access the existing samples. | |
LoanedSamples< T > | TakeSamples (int maxCount) |
Provides a loaned container to access the existing samples. | |
IList< Sample< T > > | TakeSamples (IList< Sample< T >> samples, int maxCount) |
Copies existing samples into a list. | |
bool | ReadSample (Sample< T > sample) |
Copies the contents of a sample into a Sample. | |
LoanedSamples< T > | ReadSamples () |
Provides a loaned container to access the existing samples. | |
LoanedSamples< T > | ReadSamples (int maxCount) |
Provides a loaned container to access the existing samples. | |
IList< Sample< T > > | ReadSamples (IList< Sample< T >> samples, int maxCount) |
Copies existing samples into a list. | |
bool | WaitForSamples (Duration_t maxWait) |
Waits for samples. | |
bool | WaitForSamples (int minCount, Duration_t maxWait) |
Waits for samples. | |
void | AcknowledgeAll (bool isPositiveAck) |
Acknowledge all previously accessed samples. | |
void | AcknowledgeSample (SampleInfo sampleInfo, bool isPositiveAck) |
Explicitly acknowledges a single sample. | |
void | SendAvailability (ConsumerAvailabilityParams_t parameters) |
Sends the QueueConsumer availability to Queuing Service. | |
bool | HasMatchingSharedReaderQueue () |
Checks whether this QueueConsumer has matched at least one SharedReaderQueue. | |
Sample< T > | CreateSample () |
Creates a Sample for receiving samples from the SharedReaderQueue. | |
Sample< T > | CreateSample (T data) |
Creates a Sample for receiving samples from the SharedReaderQueue. | |
Properties | |
TypedDataReader< T > | Reader [get] |
Retrieves the underlying DDS::DataReader. | |
GUID_t | Guid [get] |
Returns the GUID of this QueueConsumer. | |
Allows you to receive samples from a SharedReaderQueue.
A QueueConsumer is an entity that allows you to receive samples from a SharedReaderQueue hosted by Queuing Service. A QueueConsumer has one underlying DDS::DataReader to communicate with a SharedReaderQueue.
Valid types for the topic of the DataReader (T
) are those generated by the rtiddsgen code generator, the DDS built-in types, and DynamicData
.
For example:
To receive samples from a SharedReaderQueue, a QueueConsumer must set its topic name (see RTI::Connext::Queuing::QueueConsumerParams<T>::SetQueueTopicName) equal to the SharedReaderQueue topic name (set with the XML tag <topic_name> under <shared_reader_queue>).
In addition, the QueueConsumer must set its SharedSubscriber name (RTI::Connext::Queuing::QueueConsumerParams<T>::SetSharedSubscriberName) equal to the name of the SharedSubscriber hosting the SharedReaderQuueue.
The QueueConsumer and the SharedReaderQueue must also be in the same DDS domain (that is, they must have the same domain ID).
A QueueConsumer has an associated DDS::DomainParticipant, which can be shared with other QueueConsumers or RTI Connext routines. All the other DDS entities required for queuing interaction, including the DDS::DataReader to receive samples, are automatically created when the QueueConsumer is constructed.
Quality of Service (QoS) for the underlying DataReader is configurable (see RTI::Connext::Queuing::QueueConsumerParams<T>::SetQosProfile and RTI::Connext::Queuing::QueueConsumerParams<T>::SetDataReaderQos).
If no QoS is specified in the RTI::Connext::Queuing::QueueConsumerParams<T>, the default DataReaderQos will be used.
A QueueConsumer must always be reliable in order to match and communicate with the SharedReaderQueue. In addition, it shall use application acknowledgement to notify Queuing Service that a sample has been consumed successfully. Hence, whichever DataReaderQos is selected, the following QoS settings are always overriden:
The underlying DataReader is created with an internal DDS::DataReaderListener, which is required to provide the behavior of a QueueConsumer, including notification of events via RTI::Connext::Queuing::QueueConsumerListener<T>. For this reason, when accessing the underlying DataReader, the listener should not be set, removed or modified; otherwise the behavior of the QueueConsumer will be incorrect and unpredictable.
Optionally, a QueueConsumer can be configured to create an availability channel (RTI::Connext::Queuing::QueueConsumerParams<T>::SetEnableAvailability). This channel is used to report the QueueConsumer's availability to the SharedReaderQueue from which the QueueConsumer receives samples. Queuing Service uses the reported availability to distribute samples to the QueueConsumer.
If the availability channel is enabled for the QueueConsumer, a DDS::DataWriter is created to send availability samples to the SharedReaderQueue.
You can configure the DataWriterQos used by the availability DataWriter by using RTI::Connext::Queuing::QueueConsumerParams<T>::SetQosProfile.
Whichever DataWriterQos is selected, the following QoS settings are always overriden:
T | The data type for the SharedReaderQueue topic |
T | : | class | |
T | : | global | |
T | : | DDS.ICopyable<T> | |
T | : | new() |
|
inline |
Creates a QueueConsumer with the minimum set of parameters.
participant | The DomainParticipant that this QueueConsumer uses to join a DDS domain. |
queueTopicName | The queue topic name as specified in a Queuing Service SharedReaderQueue configuration. See RTI::Connext::Queuing::QueueConsumerParams<T>::SetQueueTopicName |
sharedSubscriberName | The name of the SharedSubscriber in a Queuing Service that hosts the queue. See RTI::Connext::Queuing::QueueConsumerParams<T>::SetSharedSubscriberName |
queueTypeSupport | The type support for type T |
One | of the Standard Return Codes |
|
inline |
Creates a QueueConsumer with parameters.
params | All the parameters that configure this QueueConsumer |
One | of the Standard Return Codes |
|
inline |
Waits for a sample and copies its contents into a Sample.
Equivalent to using WaitForSamples(int,Duration_t) and TakeSample(Sample<T>).
|
inline |
Waits for multiple samples and copies them into a list.
Equivalent to ReceiveSamples(IList<Sample<T>>,int,int,Duration_t) with min_count = 0
.
|
inline |
Waits for multiple samples and copies them into a list.
Equivalent to using WaitForSamples(int,Duration_t) and TakeSamples(IList<Sample<T>>,int).
|
inline |
Waits for multiple samples and provides a loaned container to access them.
Equivalent to using ReceiveSamples(int,int,Duration_t) with min_count=1
and max_count=DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED
.
|
inline |
Waits for multiple samples and provides a loaned container to access them.
Equivalent to using WaitForSamples(int,Duration_t) and TakeSamples(int).
|
inline |
Copies the contents of a sample into a Sample.
Takes a sample from the QueueConsumer and makes a copy.
This operation may be used after a call to WaitForSamples(int,Duration_t).
To avoid copies, you can use .
sample | The sample where the reply data and the related SampleInfo are copied |
sample
remain unchanged, except DDS::SampleInfo::valid_data becomes false. One | of the Standard Return Codes |
|
inline |
Provides a loaned container to access the existing samples.
This operation is equivalent to using TakeSamples(int) with max_count=DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED
.
|
inline |
Provides a loaned container to access the existing samples.
Takes all the existing samples up to maxCount
and provides a loaned container to access them.
This operation does not make a copy of the data.
The loan is returned with RTI::Connext::Infrastructure::LoanedSamples<T>::Dispose.
This operation may be used after a call to WaitForSamples(int,Duration_t).
maxCount | The maximum number of samples that are taken at a time. The special value DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED may be used. This value will read up to the limit specified by DDS::DataReaderResourceLimitsQosPolicy::max_samples_per_read. |
One | of the Standard Return Codes |
|
inline |
Copies existing samples into a list.
Takes all the existing samples up to maxCount
and copies them into a list.
If the first argument is null, this creates a new list containing the copies and returns the list.
If a non-null list is passed as the first argument, the copies are inserted into that list. The list may already contain some elements. Any existing elements are overwritten. If the list contains fewer elements than needed, samples are appended at the end; if it contains more elements than needed, the excess samples are removed from the end.
You can use this operation after a call to WaitForSamples(int,Duration_t).
replies | The list where the samples are copied, or null to create a new list. |
maxCount | The maximum number of samples that are taken at a time. The special value DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED may be used. |
replies
if it is not null
. Otherwise it returns a new list. One | of the Standard Return Codes |
|
inline |
Copies the contents of a sample into a Sample.
This operation is equivalent to RTI::Connext::Queuing::QueueConsumer<T>::TakeSample(Sample<T>), except the sample remains in the QueueConsumer and can be read or taken again.
|
inline |
Provides a loaned container to access the existing samples.
This operation is equivalent to RTI::Connext::Queuing::QueueConsumer<T>::TakeSamples(), except the samples remain in the QueueConsumer and can be read or taken again.
|
inline |
Provides a loaned container to access the existing samples.
This operation is equivalent to RTI::Connext::Queuing::QueueConsumer<T>::TakeSamples(int), except the samples remain in the QueueConsumer and can be read or taken again.
|
inline |
Copies existing samples into a list.
This operation is equivalent to RTI::Connext::Queuing::QueueConsumer<T>::TakeSamples(IList<Sample<T>>,int), except the samples remain in the QueueConsumer and can be read or taken again.
|
inline |
Waits for samples.
This operation is equivalent to WaitForSamples(int,Duration_t) with min_count=1
.
|
inline |
Waits for samples.
This operation waits for minCount samples to be available. It will wait up to maxWait .
If this operation is called several times but the available samples are not taken (with ), this operation may return immediately and will not wait for new samples. New samples may replace existing ones if they are not taken, depending on the DDS::HistoryQosPolicy used to configure this QueueConsumer.
minCount | Minimum number of replies that need to be available for this operation to unblock. |
maxWait | Maximum waiting time after which this operation unblocks, regardless of how many replies are available. |
minCount | Minimum number of samples that need to be available for this operation to unblock. |
maxWait | Maximum waiting time after which this operation unblocks regardless of how many samples are available. |
|
inline |
Acknowledge all previously accessed samples.
This is equivalent to calling AcknowledgeSample(SampleInfo, bool) for every single previously accessed sample.
isPositiveAck | Indicates whether or not the acknowledged samples were successfully processed by the application. If the samples were not processed successfully, Queuing Service will try to redeliver them to a different QueueConsumer according to the delivery policy of the SharedReaderQueue. |
One | of the Standard Return Codes |
|
inline |
Explicitly acknowledges a single sample.
This operation calls DDS::DataReader::acknowledge_sample on the underlying DataReader.
The parameter isPositiveAck indicates whether or not the acknowledged sample was successfully processed by the application. If the sample was not processed successfully, Queuing Service will try to redeliver it to a different QueueConsumer according to the delivery policy of the SharedReaderQueue.
sampleInfo | Identifies the sample being acknowledged. The sampleInfo can be extracted from RTI::Connext::Infrastructure::Sample<T>::Info. |
isPositiveAck | Indicates whether or not the sample was succesfully processed. |
One | of the Standard Return Codes |
|
inline |
Sends the QueueConsumer availability to Queuing Service.
This method will use the availability DataWriter to send a sample to Queue Service indicating the availability status of the QueueConsumer application.
The method throws DDS::Retcode_PreconditionNotMet if availability is not enabled for this QueueConsumer using RTI::Connext::Queuing::QueueConsumerParams<T>::SetEnableAvailability.
One | of the Standard Return Codes ; |
parameters | Availability status |
|
inline |
Checks whether this QueueConsumer has matched at least one SharedReaderQueue.
One | of the Standard Return Codes ; |
|
inline |
Creates a Sample for receiving samples from the SharedReaderQueue.
T
and invalid SampleInfo.
|
inline |
Creates a Sample for receiving samples from the SharedReaderQueue.
|
get |
Retrieves the underlying DDS::DataReader.
Accessing the DataReader may be useful for a number of advanced use cases, such as getting DataReader protocol or cache statuses.
|
get |
Returns the GUID of this QueueConsumer.
The GUID of the QueueConsumer is determined based on the value of RTI::Connext::Queuing::QueueConsumerParams<T>::SetEntityName and RTI::Connext::Queuing::QueueConsumerParams<T>::SetQueueTopicName. Note that the QueueConsumer GUID may be equal or different than the GUID of the underlying DataReader virtual GUID.
The GUID identifies a QueueConsumer and the samples it consumes. The underlying DataReader's content filter on the related_reader_guid is set to the QueueConsumer's GUID.