RTI Connext Modern C++ API
Version 6.0.0
|
Allows receiving requests and sending replies. More...
#include <rti/queuing/QueueReplier.hpp>
Public Member Functions | |
QueueReplier (const QueueReplierParams ¶ms, bool is_enabled=true, Listener *replier_listener=NULL, const rti::core::Guid &replier_guid=rti::core::Guid::unknown()) | |
Creates a Replier with parameters. | |
void | listener (Listener *the_listener, const dds::core::status::StatusMask &event_mask=dds::core::status::StatusMask::none()) |
Sets the listener associated with this queue requester. | |
Listener * | listener () const |
Returns the listener currently associated with this requester. | |
void | enable () |
Enables the QueueReplier to send data, receive data and receive listener notifications. | |
void | send_reply (const TRep &reply, const dds::sub::SampleInfo &related_request_info) |
Sends a reply for a previous request. | |
void | send_reply (const TRep &reply, rti::pub::WriteParams &write_params) |
Sends a reply with the specified parameters and gets back metadata information related to the reply sent. | |
void | acknowledge_request (const dds::sub::SampleInfo &sample_info, bool is_positive_acknowledgment=true) |
Explicitly acknowledges a single request. | |
void | acknowledge_all (bool is_positive_acknowledgment=true) |
Acknowledges all previously accessed requests. | |
bool | wait_for_acknowledgments (const dds::core::Duration &max_wait) |
Blocks the calling thread until all replies written by this QueueReplier are acknowledged by Queuing Service, or until a timeout occurs. | |
bool | wait_for_acknowledgments (const rti::core::SampleIdentity &identity, const dds::core::Duration &max_wait) |
Blocks the calling thread until the reply identified by identity is acknowledged by Queuing Service, or until a timeout occurs. | |
rti::queuing::QueueConsumer< TReq > | consumer () const |
Retrieves the underlying dds::sub::DataReader. | |
rti::queuing::QueueProducer< TRep > | producer () const |
Retrieves the underlying dds::pub::DataWriter. | |
void | send_availability (ConsumerAvailabilityParams parameters) |
Sends an availability sample with the specified parameters. The availability applies to the reply queue. | |
bool | has_matching_request_reader_queue () |
Checks whether or not this QueueReplier has matched with at least one request SharedReaderQueue. | |
bool | has_matching_reply_reader_queue () |
Checks whether or not this QueueReplier has matched with at least one reply SharedReaderQueue. | |
bool | wait_for_requests (const dds::core::Duration &max_wait) |
Waits for requests. | |
bool | wait_for_requests (int min_count, const dds::core::Duration &max_wait) |
Waits for requests. | |
dds::sub::LoanedSamples< TReq > | receive_requests (const dds::core::Duration &max_wait) |
Waits for multiple requests and provides a loaned container to access them. | |
dds::sub::LoanedSamples< TReq > | receive_requests (int min_count, int max_count, const dds::core::Duration &max_wait) |
Waits for multiple requests and provides a loaned container to access them. | |
rti::pub::WriteParams | get_write_params_for_related_request (rti::pub::WriteParams &write_params, const dds::sub::SampleInfo &related_request_info) |
Gets the write parameters ready to send a reply for a given related request. | |
dds::sub::LoanedSamples< TReq > | take_requests () |
Provides a loaned container to access the existing requests. | |
dds::sub::LoanedSamples< TReq > | take_requests (int max_count) |
Provides a loaned container to access the existing requests. | |
dds::sub::LoanedSamples< TReq > | read_requests () |
Provides a loaned container from which you can access the existing requests. | |
dds::sub::LoanedSamples< TReq > | read_requests (int max_count) |
Provides a loaned container from which you can access the existing requests. | |
dds::pub::DataWriter< TRep > | writer () const |
Retrieves the underlying dds::pub::DataWriter used to send replies. | |
dds::sub::DataReader< TReq > | reader () const |
Retrieves the underlying dds::sub::DataReader used to receive requests. | |
rti::core::Guid | guid () |
Returns the GUID of this QueueReplier. | |
Allows receiving requests and sending replies.
A QueueReplier is a component suited for the queuing request-reply use case. A QueueReplier plays the role of a request QueueConsumer and reply QueueProducer.
A QueueReplier is an entity that allows you to receive requests from a request SharedReaderQueue and send replies to a reply SharedReaderQueue, which are hosted by Queuing Service.
To communicate with the SharedReaderQueues, the QueueReplier creates two topics. The first topic corresponds to the request SharedReaderQueue topic and the second topic to the reply SharedReaderQueue topic.
Valid types for these topics (TReq
and TRep
) are: those generated by the rtiddsgen code generator, the DDS built-in types, and dds::core::xtypes::DynamicData.
TReq | The data type for the request SharedReaderQueue topic |
TRep | The data type for the reply SharedReaderQueue topic |
|
inlineexplicit |
Creates a Replier with parameters.
params | All the parameters that configure this QueueReplier See QueueReplierParams for the list of required parameters. |
is_enabled | Specifies if the QueueReplier is created ready to receive notifications in its listener and send or receive data. If you choose to bind the QueueReplier to a QueueReplierListener using an rti::core::ListenerBinder you should create the QueueReplier disabled to avoid missing listener notifications. You can later enable the disabled QueueReplier using QueueReplier::enable. |
replier_listener | A pointer to a QueueReplierListener object to receive event notifications. If you provide the listener at construction time you should also detach the listener before the QueueReplier is deleted. The QueueReplier is not automatically deleted until the listener is set to NULL. If you want the detachment of the listener to be automatically managed set replier_listener = NULL and use an rti::core::ListenerBinder instead. |
replier_guid | A GUID identifier for the replier. When replier_guid is set to rti::core::Guid::unknown() the Guid identifier is generated automatically. You can retrieve the generated QueueReplier Guid using the QueueReplier::guid() method. To restart a QueueReplier just create a new one with its same GUID. |
One | of the Standard Exceptions |
|
inline |
Sets the listener associated with this queue requester.
the_listener | The QueueReplierListener to set |
event_mask | The dds::core::status::StatusMask associated with the listener |
|
inline |
Returns the listener currently associated with this requester.
If there is no listener it returns NULL.
|
inline |
Enables the QueueReplier to send data, receive data and receive listener notifications.
If you create the QueueReplier disabled you can enable it using this mehtod. To avoid missing listener notifciation when you use an rti::core::ListenerBinder to bind the QueueReplier to a QueueReplierListener use QueueReplier::enable to enable the QueueReplier after it is bound to the listener.
|
inline |
Sends a reply for a previous request.
The related request identity can be retrieved from an existing request sample (Sample).
reply | The reply to be sent |
related_request_info | The identity of a previously received request |
One | of the Standard Exceptions |
|
inline |
Sends a reply with the specified parameters and gets back metadata information related to the reply sent.
After calling this operation, write_params contains metadata information associated with the reply sent.
Contrary to the QueueRequester, where retrieving the sample identity for correlation is common, on the QueueReplier side using a write_params is only necessary when the default write parameters need to be overridden, and QueueReplier::send_reply(const TRep&, const dds::sub::SampleInfo&) may be used if that is not necessary.
reply | <<in>> the reply sample to send. |
write_params | <<inout>> Parameters used to send the reply. When this call ends successfully, write_params contains valid metadata information associated with the reply sent. |
One | of the Standard Exceptions or NoMatchingQueueException if by the time this operation is called there is not a single matching SharedReaderQueue. |
|
inline |
Explicitly acknowledges a single request.
|
inline |
Acknowledges all previously accessed requests.
|
inline |
Blocks the calling thread until all replies written by this QueueReplier are acknowledged by Queuing Service, or until a timeout occurs.
|
inline |
Blocks the calling thread until the reply identified by identity is acknowledged by Queuing Service, or until a timeout occurs.
|
inline |
Retrieves the underlying dds::sub::DataReader.
|
inline |
Retrieves the underlying dds::pub::DataWriter.
|
inline |
Sends an availability sample with the specified parameters. The availability applies to the reply queue.
|
inline |
Checks whether or not this QueueReplier has matched with at least one request SharedReaderQueue.
|
inline |
Checks whether or not this QueueReplier has matched with at least one reply SharedReaderQueue.
|
inline |
Waits for requests.
|
inline |
Waits for requests.
|
inline |
Waits for multiple requests and provides a loaned container to access them.
|
inline |
Waits for multiple requests and provides a loaned container to access them.
|
inline |
Gets the write parameters ready to send a reply for a given related request.
You can use this method to modify the parameters before you send a reply using QueueReplier::send_reply(const TRep&, rti::pub::WriteParams&).
write_params | <<out>> the write params to send the reply. |
related_request_info | <<in>> The sample info of the releated request. |
|
inline |
Provides a loaned container to access the existing requests.
|
inline |
Provides a loaned container to access the existing requests.
|
inline |
Provides a loaned container from which you can access the existing requests.
This operation is equivalent to QueueReplier::take_requests(), except the sample remains in the QueueReplier and can be read or taken again.
|
inline |
Provides a loaned container from which you can access the existing requests.
This operation is equivalent to QueueReplier::take_requests(int), except the sample remains in the QueueReplier and can be read or taken again.
|
inline |
Retrieves the underlying dds::pub::DataWriter used to send replies.
|
inline |
Retrieves the underlying dds::sub::DataReader used to receive requests.
|
inline |
Returns the GUID of this QueueReplier.
The QueueReplier's GUID is the same GUID of both underlying QueueProducer and QueueConsumer.