Inherits IDisposable.
|
SampleIdentity | SendRequest (TRequest request) |
| Sends a request. More...
|
|
void | SendRequest (TRequest request, WriteParams writeParams) |
| Sends a request. More...
|
|
LoanedSamples< TReply > | ReceiveReplies (int minCount, Duration maxWait) |
| Receives a number of replies. More...
|
|
LoanedSamples< TReply > | TakeReplies () |
| Takes all replies. More...
|
|
LoanedSamples< TReply > | TakeReplies (SampleIdentity relatedRequestId) |
| Takes all of the replies for a specific request identified by a SampleIdentity. More...
|
|
LoanedSamples< TReply > | ReadReplies () |
| Reads all replies. More...
|
|
LoanedSamples< TReply > | ReadReplies (SampleIdentity relatedRequestId) |
| Reads all of the replies for a specific request, identified by a SampleIdentity. More...
|
|
bool | WaitForReplies (int minCount, Duration maxWait) |
| Wait for a number of replies for a duration of time. More...
|
|
bool | WaitForReplies (int minCount, SampleIdentity relatedRequestId, Duration maxWait) |
| Wait for a number of replies identified by a SampleIdentity. for a duration of time. More...
|
|
async Task< int > | WaitForRepliesAsync (int minCount=1, CancellationToken cancellationToken=default) |
| Wait for a number of replies asynchronously until a minimum number of replies reach the Requester, or a cancellation is requested using a CancellationToken, More...
|
|
async Task< int > | WaitForRepliesAsync (int minCount, SampleIdentity relatedRequestId, CancellationToken cancellationToken=default) |
| Wait for a number of replies identified by a SampleIdentity asynchronously until a minimum number of replies reach the Requester, or a cancellation is requested using a CancellationToken, More...
|
|
uint | GetMatchedReplierCount () |
| Returns the number of Replier's that are currently matched with this Requester. More...
|
|
void | Dispose () |
| Releases the native resources used by this object. More...
|
|
Allows sending requests and receiving replies.
- Template Parameters
-
TRequest | The type of the requests to be sent. |
TReply | The type of the replies to be received. |
A Requester is an entity with two associated topics: a request topic and a reply topic. It can send requests by publishing samples of the request topic and receive replies to those requests by subscribing to the reply topic.
Valid types for these topics are: those generated by the rtiddsgen code generator, the DDS built-in types and Rti.Types.Dynamic.DynamicData.
A Replier and a Requester communicate when they use the same topics for requests and replies (see RequesterBuilder<TRequest, TReply>.WithServiceName) on the same domain ID. A Requester can send requests and receive one or multiple replies. It does that using the following operations:
- Sending requests (i.e. publishing request samples on the request topic)
- Waiting for replies to be received by the middleware (for any request or for a specific request)
- Getting those replies from the middleware. There are two ways to do this: take (the data samples are removed from the middleware) or read (the data samples remain in the middleware and can be read or taken again).
- A convenience operation, receive (which is a combination of wait and take).
In all cases, the middleware guarantees that a requester only receives reply samples that are associated with those requests that it sends.
For multi-reply scenarios, in which a Requester receives multiple replies from a Replier for a given request, the Requester can check if a reply is the last reply of a sequence of replies. To do so, see if the bit SampleFlags.IntermediateReplySequence is set in Rti.Dds.Subscription.SampleInfo.Flag after receiving each reply. This indicates it is NOT the last reply.
A Requester has an associated Rti.Dds.Domain.DomainParticipant, which can be shared with other requesters or RTI Connext routines. All the other RTI Connext entities required for the request-reply interaction, including a DataWriter<TRequest> for writing requests and a DataReader<TReply> for reading replies, are automatically created when the requester is constructed.
Quality of Service for the underlying DataWriter and DataReader can be configured (see RequesterBuilder<TRequest, TReply>.WithDataWriterQos and RequesterBuilder<TRequest, TReply>.WithDataReaderQos). By default, they are created with Rti.Dds.Core.Policy.ReliabilityKind.Reliable. The exact default QoS configuration is described in the Modern C++ API: Configuring Request-Reply QoS profiles.
Use participant.BuildRequester<TRequest, TReply>()
(an extension method defined in DomainParticipantRequestReplyExtensions) to configure and build a Requester.
For example, to create a basic Requester:
var requester = participant.BuildRequester<FooRequest, FooReply>()
.WithServiceName("FooService")
.Create();
See also Request-Reply Examples.