Inherits AlreadyDisposedHelper< Replier< TReq, TRep >>, and IDisposable.
|
| Replier (ReplierParams< TReq, TRep > parameters) |
| Creates a Replier with parameters. More...
|
|
| Replier (DomainParticipant participant, String serviceName, TypeSupport requestTypeSupport, TypeSupport replyTypeSupport) |
| Creates a Replier with the minimum set of parameters. More...
|
|
void | SendReply (TRep reply, SampleIdentity_t relatedRequestId) |
| Sends a reply for a previous request. More...
|
|
void | SendReply (WriteSample< TRep > reply, SampleIdentity_t relatedRequestId) |
| Sends a reply for a previous request. More...
|
|
bool | ReceiveRequest (Sample< TReq > request, Duration_t maxWait) |
| Waits for a request and copies its contents into a Sample. More...
|
|
IList< Sample< TReq > > | ReceiveRequests (IList< Sample< TReq >> replies, int maxCount, Duration_t maxWait) |
| Waits for multiple requests and copies them into a list. More...
|
|
IList< Sample< TReq > > | ReceiveRequests (IList< Sample< TReq >> replies, int minCount, int maxCount, Duration_t maxWait) |
| Waits for multiple requests and copies them into a list. More...
|
|
RTI.Connext.Infrastructure.LoanedSamples< TReq > | ReceiveRequests (Duration_t maxWait) |
| Waits for multiple requests and provides a loaned container to access them. More...
|
|
RTI.Connext.Infrastructure.LoanedSamples< TReq > | ReceiveRequests (int minCount, int maxCount, Duration_t maxWait) |
| Waits for multiple requests and provides a loaned container to access them. More...
|
|
bool | TakeRequest (Sample< TReq > request) |
| Copies the contents of a request into a Sample. More...
|
|
RTI.Connext.Infrastructure.LoanedSamples< TReq > | TakeRequests () |
| Provides a loaned container to access the existing requests. More...
|
|
RTI.Connext.Infrastructure.LoanedSamples< TReq > | TakeRequests (int maxCount) |
| Provides a loaned container to access the existing requests. More...
|
|
IList< Sample< TReq > > | TakeRequests (IList< Sample< TReq >> requests, int maxCount) |
| Copies existing requests into a list. More...
|
|
bool | ReadRequest (Sample< TReq > request) |
| Copies the contents of a request into a Sample. More...
|
|
RTI.Connext.Infrastructure.LoanedSamples< TReq > | ReadRequests () |
| Provides a loaned container to access the existing requests. More...
|
|
RTI.Connext.Infrastructure.LoanedSamples< TReq > | ReadRequests (int maxCount) |
| Provides a loaned container to access the existing requests. More...
|
|
IList< Sample< TReq > > | ReadRequests (IList< Sample< TReq >> requests, int maxCount) |
| Copies existing requests into a list. More...
|
|
bool | WaitForRequests (Duration_t maxWait) |
| Waits for requests. More...
|
|
bool | WaitForRequests (int minCount, Duration_t maxWait) |
| Waits for requests. More...
|
|
WriteSample< TRep > | CreateReplySample () |
| Creates a WriteSample for sending replies. More...
|
|
WriteSample< TRep > | CreateReplySample (TRep data) |
| Creates a WriteSample for sending replies. More...
|
|
Sample< TReq > | CreateRequestSample () |
| Creates a Sample for receiving replies. More...
|
|
Allows receiving requests and sending replies.
A Replier is an entity with two associated topics: a request topic and a reply topic. It can receive requests by subscribing to the request topic and can send replies to those requests by publishing the reply topic.
Valid types for these topics (TReq
and TRep
)are: those generated by the rtiddsgen code generator, the DDS built-in types, and DDS::DynamicData. See Creating a Replier.
A Replier has four main types of operations:
- Waiting for requests to be received from the middleware
- Getting those requests
- Receiving requests (a convenience operation that is a combination of waiting and getting in a single operation)
- Sending a reply for a previously received request (i.e., publishing a reply sample on the reply topic with special meta-data so that the orignal Requester can identify it)
For multi-reply scenarios in which a RTI::Connext::RequestReply::Replier<TReq,TRep> generates more than one reply for a request, the RTI::Connext::RequestReply::Replier<TReq,TRep> should mark all the intermediate replies (all but the last) using the INTERMEDIATE_REPLY_SEQUENCE_SAMPLE flag in DDS::WriteParams_t::flag.
Much like a Requester, a Replier has an associated DDS::DomainParticipant, which can be shared with other Repliers or RTI Connext routines. All the other entities required for the request-reply interaction, including a DDS::DataWriter for writing replies and a DDS::DataReader for reading requests, are automatically created when the Replier is constructed.
Quality of Service for the underlying DataWriter and DataReader can be configured (see RTI::Connext::RequestReply::RequesterParams::SetQosProfile). By default, they are created with DDS::ReliabilityQosPolicyKind::RELIABLE_RELIABILITY_QOS. The exact default configuration is described here: Configuring Request-Reply QoS profiles
There are several ways to use a Replier:
- A thread receives requests and then dispatches them. If the computation of a reply is a simple operation, consider using a RTI::Connext::RequestReply::SimpleReplier<TReq,TRep> instead of a Replier.
- Polling without waiting, using TakeRequests(int) directly.
- Using a RTI::Connext::RequestReply::ReplierListener<TReq,TRep> to get notified and get the requests within the callback.
- Template Parameters
-
TReq | The data type for the request topic |
TRep | The data type for the reply topic |
- See also
- RTI::Connext::RequestReply::Requester<TReq,TRep>
-
Request-Reply Examples
-
Basic Replier example
Sends a reply for a previous request.
Allows you to set custom parameters for writing a reply.
Contrary to the RTI::Connext::RequestReply::Requester<TReq,TRep>, where retrieving the sample identity for correlation is common, on the Replier side using a WriteSample is only necessary when the default write parameters need to be overridden, and SendReply(TRep, SampleIdentity_t) may be used if that is not necessary.
One reason to override the default write parameters is a multi-reply scenario in which a RTI::Connext::RequestReply::Replier<TReq,TRep> generates more than one reply for a request. In this case, all the intermediate replies (all but the last) should be marked with the INTERMEDIATE_REPLY_SEQUENCE_SAMPLE flag in DDS::WriteParams_t::flag within RTI::Connext::Infrastructure::WriteSample<T>::Info.
A RTI::Connext::RequestReply::Requester<TReq,TRep> can detect if a reply is the last reply of a sequence of replies by checking that the flag INTERMEDIATE_REPLY_SEQUENCE_SAMPLE is not set in DDS::SampleInfo::flag within RTI::Connext::Infrastructure::Sample<T>::Info.
- See also
- SendReply(TRep, SampleIdentity_t)
-
RTI::Connext::Infrastructure::WriteSample<T>