RTI Connext .Net APIs  Version 5.2.0
 All Classes Namespaces Functions Variables Enumerations Properties Groups Pages
RTI.Connext.Queuing.QueueProducer< T > Class Template Reference

Allows you to send samples to a specific SharedReaderQueue hosted by Queuing Service. More...

Inherits AlreadyDisposedHelper< QueueProducer< T >>, and IDisposable.

Inherited by RTI.Connext.Queuing.QueueProducer< T >.EmptyProducerListener, and RTI.Connext.Queuing.QueueProducer< T >.QueueProducerWriterListener.

Public Member Functions

 QueueProducer (DomainParticipant participant, String queueTopicName, TypeSupport queueTypeSupport)
 Creates a QueueProducer with the minimum set of parameters.
 
 QueueProducer (QueueProducerParams< T > parameters)
 Creates a QueueProducer with parameters.
 
void SendSample (T sample)
 Sends a sample.
 
void SendSample (WriteSample< T > sample)
 Sends a sample with the specified parameters and gets back metadata information related to the sample sent.
 
bool WaitForAcknowledgements (Duration_t maxWait)
 Blocks the calling thread until all samples written by this QueueProducer since the last call to this method are acknowledged by Queuing Service.
 
bool WaitForAcknowledgements (SampleIdentity_t identity, Duration_t maxWait)
 Blocks the calling thread until the sample identified by identity is acknowledged by Queuing Service.
 
bool HasMatchingSharedReaderQueue ()
 Checks whether this QueueProducer has matched with at least one SharedReaderQueue.
 
WriteSample< T > CreateWriteSample ()
 Creates a WriteSample for sending samples.
 
WriteSample< T > CreateWriteSample (T data)
 Creates a WriteSample for sending samples.
 

Properties

TypedDataWriter< T > Writer [get]
 Retrieves the underlying DDS::DataWriter.
 
GUID_t Guid [get]
 Returns the GUID of this QueueProducer.
 

Detailed Description

Allows you to send samples to a specific SharedReaderQueue hosted by Queuing Service.

A QueueProducer is an entity that allows you to send samples to a SharedReaderQueue hosted by Queuing Service. A QueueProducer has one underlying DDS::DataWriter to communicate with a SharedReaderQueue.

Valid types for the topic of the DataWriter (T) are those generated by the rtiddsgen code generator , the DDS built-in types , and DynamicData .

For example:

QueueProducer<Foo> producer
QueueProducer<DynamicData> producer
QueueProducer<Octets> producer

To send samples to a SharedReaderQueue, a QueueProducer must set its topic name (see RTI::Connext::Queuing::QueueProducerParams<T>::SetQueueTopicName) equal to the SharedReaderQueue topic name.

The QueueProducer and the SharedReadeeQueue must also be in the same DDS domain (that is, they must have the same domain ID).

A QueueProducer has an associated DDS::DomainParticipant, which can be shared with other QueueProducers or RTI Connext routines. All the other RTI Connext entities required for queuing interaction, including a DDS::DataWriter for writing samples, are automatically created when the QueueProducer is constructed.

Quality of Service (QoS) for the underlying DataWriter is configurable (see RTI::Connext::Queuing::QueueProducerParams<T>::SetQosProfile and RTI::Connext::Queuing::QueueProducerParams<T>::SetDataWriterQos).

If no QoS is specified in the RTI::Connext::Queuing::QueueProducerParams<T>, the default DataWriterQos will be used.

A QueueProducer must always be reliable in order to match and communicate with the SharedReaderQueue. Hence, whichever DataWriterQos is selected, the following QoS setting is always overriden:

The underlying DataWriter is created with an internal DDS::DataWriterListener, which is required to provide the behavior of a QueueProducer, including the notification of events via RTI::Connext::Queuing::QueueProducerListener<T>. For this reason, when accessing the underlying DataWriter, the listener should not be set, removed or modified; otherwise the behavior of the QueueProducer will be incorrect and unpredictable.

Template Parameters
TThe data type for the SharedReaderQueue topic
See Also
RTI::Connext::Queuing::QueueProducer<T>
RTI::Connext::Queuing::QueueProducerListener<T>
Type Constraints
T :class 
T :global 
T :DDS.ICopyable<T> 
T :new() 

Constructor & Destructor Documentation

RTI.Connext.Queuing.QueueProducer< T >.QueueProducer ( DomainParticipant  participant,
String  queueTopicName,
TypeSupport  queueTypeSupport 
)
inline

Creates a QueueProducer with the minimum set of parameters.

Parameters
participantThe DomainParticipant this requester uses to join a DDS domain
queueTopicNameThe queue topic name as specified in a Queuing Service SharedReaderQueue configuration. See RTI::Connext::Queuing::QueueProducerParams<T>::SetQueueTopicName
queueTypeSupportThe type support for type T
Exceptions
Oneof the Standard Return Codes
RTI.Connext.Queuing.QueueProducer< T >.QueueProducer ( QueueProducerParams< T >  parameters)
inline

Creates a QueueProducer with parameters.

Parameters
paramsAll the parameters that configure this QueueProducer. See RTI::Connext::Queuing::QueueProducerParams<T> for the list of required parameters.
Exceptions
Oneof the Standard Return Codes
See Also
RTI::Connext::Queuing::QueueProducerParams<T>

Member Function Documentation

void RTI.Connext.Queuing.QueueProducer< T >.SendSample ( sample)
inline

Sends a sample.

This operation is equivalent to calling SendSample(WriteSample<T>) using a default RTI::Connext::Infrastructure::WriteSample<T>.

Parameters
sampleThe sample to be sent
Exceptions
Oneof the Standard Return Codes or RTI::Connext::Queuing::Infrastructure::NoMatchingQueueException
MT Safety:
SAFE
See Also
SendSample(WriteSample<T>)
void RTI.Connext.Queuing.QueueProducer< T >.SendSample ( WriteSample< T >  sample)
inline

Sends a sample with the specified parameters and gets back metadata information related to the sample sent.

After calling this operation, the sample contains valid metadata information associated with the sample sent.

The metadata field DDS::WriteParams_t::source_guid of the write parameters in the sample is always set to this QueueProducer's GUID.

Parameters
sample<<inout>> Contains the sample and optional write parameters. When this call ends successfully, RTI::Connext::Infrastructure::WriteSample<T> contains valid metadata information associated with the sample sent.
Exceptions
Oneof the Standard Return Codes or RTI::Connext::Queuing::Infrastructure::NoMatchingQueueException if by the time this operation is called there is not a single matching SharedReaderQueue.
MT Safety:
SAFE
See Also
RTI::Connext::Infrastructure::WriteSample<T>
CreateWriteSample()
Guid
bool RTI.Connext.Queuing.QueueProducer< T >.WaitForAcknowledgements ( Duration_t  maxWait)
inline

Blocks the calling thread until all samples written by this QueueProducer since the last call to this method are acknowledged by Queuing Service.

This operation will keep the calling thread blocked as long as there are samples pending on acknowledgement, unless a timeout occurs.

After unblocking, the return value is true if all samples have been acknowledged positively or false if at least one of them was acknowledged negatively.

If there is a timeout, this operation throws DDS::Retcode_Timeout.

This operation requires setting RTI::Connext::Queuing::QueueProducerParams<T>::SetEnableWaitForAck to true. Otherwise, it will throw DDS::Retcode_PreconditionNotMet.

When a SharedReaderQueue is not replicated, a sample is acknowledged positively once the running Queuing Service instance has enqueued the sample.

When a SharedReaderQueue is replicated, a sample is acknowledged positively once it has been enqueued by the Queuing Service instance acting as a master. This means that the sample has been received and enqueued by a configurable quorum of instances (using <replication_settings>/<queue_instances>).

This operation waits until all the previously written samples since the last call to this method are acknowledged. If you want to wait for a specific sample, use the method RTI::Connext::Queuing::QueueProducer<T>::WaitForAcknowledgements(SampleIdentity_t,Duration_t).

This operation cannot be called by two threads concurrently. If this occurs, the second thread will throw DDS::Retcode_PreconditionNotMet.

This operation cannot be called concurrently with RTI::Connext::Queuing::QueueProducer<T>::WaitForAcknowledgements(SampleIdentity_t,Duration_t) either.

Parameters
maxWait<<in>> Maximum waiting time.
Returns
true if all the samples are acknowledged positively or false if there was at least one sample acknowledged negatively.
Exceptions
Oneof the Standard Return Codes ; RTI::Connext::Queuing::Infrastructure::NoMatchingQueueException if during this call, the QueueProducer lost the matching status with Queuing Service. DDS::Retcode_Timeout if a timeout occurs before receiving all the acknowledgments.
See Also
SendSample(T)
RTI::Connext::Queuing::QueueProducerListener<T>::OnSampleAcknowledged
RTI::Connext::Queuing::QueueProducer<T>::WaitForAcknowledgements(SampleIdentity_t,Duration_t)
bool RTI.Connext.Queuing.QueueProducer< T >.WaitForAcknowledgements ( SampleIdentity_t  identity,
Duration_t  maxWait 
)
inline

Blocks the calling thread until the sample identified by identity is acknowledged by Queuing Service.

This operation blocks the calling thread until the sample identified by identity is acknowledged by Queuing Service or there is a timeout.

After unblocking, the return value is true if the sample has been acknowledged positively or false if the sample has been acknowledged negatively.

If there is a timeout, this operation throws DDS::Retcode_Timeout.

This operation requires setting RTI::Connext::Queuing::QueueProducerParams<T>::SetEnableWaitForAck to true. Otherwise, it will throw DDS::Retcode_PreconditionNotMet.

When a SharedReaderQueue is not replicated, a sample is acknowledged positively once the running Queuing Service instance has enqueued the sample.

When a SharedReaderQueue is replicated, a sample is acknowledged positively once it has been enqueued by the Queuing Service instance acting as a master. This means that the sample has been received and enqueued by a configurable quorum of instances (using <replication_settings>/<queue_instances>).

This operation cannot be called by two threads concurrently on the same identity. If this occurs, the second thread will throw DDS::Retcode_PreconditionNotMet.

This operation cannot be called concurrently with RTI::Connext::Queuing::QueueProducer<T>::WaitForAcknowledgements(Duration_t) either.

Parameters
maxWait<<in>> Maximum waiting time.
identity<<in>>. Sample identity.
Returns
true if the sample is acknowledged positively or false if the sample is acknowledged negatively.
Exceptions
Oneof the Standard Return Codes ; RTI::Connext::Queuing::Infrastructure::NoMatchingQueueException if during this call, the QueueProducer lost the matching status with Queuing Service. DDS::Retcode_Timeout if a timeout occurs before receiving all the acknowledgments.
See Also
SendSample(T)
RTI::Connext::Queuing::QueueProducerListener<T>::OnSampleAcknowledged
RTI::Connext::Queuing::QueueProducer<T>::WaitForAcknowledgements(Duration_t)
bool RTI.Connext.Queuing.QueueProducer< T >.HasMatchingSharedReaderQueue ( )
inline

Checks whether this QueueProducer has matched with at least one SharedReaderQueue.

Exceptions
Oneof the Standard Return Codes ;
Returns
True if this QueueProducer matches with at least one SharedReaderQueue.
MT Safety:
SAFE
See Also
RTI::Connext::Queuing::QueueProducerListener<T>::OnSharedReaderQueueMatched
WriteSample<T> RTI.Connext.Queuing.QueueProducer< T >.CreateWriteSample ( )
inline

Creates a WriteSample for sending samples.

Returns
A new RTI::Connext::Infrastructure::WriteSample<T> with data of type T initialized with default values and default write parameters.
MT Safety:
SAFE
See Also
RTI::Connext::Infrastructure::WriteSample<T>
SendSample(WriteSample<T>)
WriteSample<T> RTI.Connext.Queuing.QueueProducer< T >.CreateWriteSample ( data)
inline

Creates a WriteSample for sending samples.

Returns
A new WriteSample with the specified data and default write parameters.
MT Safety:
SAFE
See Also
RTI::Connext::Infrastructure::WriteSample<T>
SendSample(WriteSample<T>)

Property Documentation

TypedDataWriter<T> RTI.Connext.Queuing.QueueProducer< T >.Writer
get

Retrieves the underlying DDS::DataWriter.

Accessing the DataWriter may be useful for a number of advanced use cases, such as getting the DataWriter protocol or cache statuses.

MT Safety:
SAFE
See Also
DDS::DataWriter
DDS::TypedDataWriter
DDS::DataWriter::get_datawriter_protocol_status
GUID_t RTI.Connext.Queuing.QueueProducer< T >.Guid
get

Returns the GUID of this QueueProducer.

The GUID of the QueueProducer is determined based on the value of RTI::Connext::Queuing::QueueProducerParams<T>::SetEntityName and RTI::Connext::Queuing::QueueProducerParams<T>::SetQueueTopicName. Note that the QueueProducer GUID may be equal to or different than the GUID of the underlying DataWriter virtual GUID.

The GUID identifies a QueueProducer and the samples it writes. This is the value set in the source GUID of the samples sent by the QueueProducer.

See Also
SendSample(T)
RTI::Connext::Queuing::QueueProducerParams<T>::SetEntityName

RTI Connext .Net APIs Version 5.2.0 Copyright © Sun Jun 21 2015 Real-Time Innovations, Inc