RTI Connext C# API
7.1.0
|
Allows receiving requests and sending replies. More...
Inherits IDisposable.
Public Member Functions | |
void | SendReply (TReply reply, SampleIdentity relatedRequestId) |
Sends a reply to a specific request identified by a SampleIdentity. More... | |
void | SendReply (TReply reply, SampleInfo relatedRequestInfo) |
Sends a reply to a specific request identified by a SampleInfo. More... | |
void | SendReply (TReply reply, WriteParams writeParams) |
Sends a reply. More... | |
bool | WaitForRequests (int minCount, Duration maxWait) |
Wait for a number of requests for a duration of time. More... | |
async Task< int > | WaitForRequestsAsync (int minCount=1, CancellationToken cancellationToken=default) |
Wait for a number of requests asynchronously until a minimum number of requests reach the Replier, or a cancellation is requested using a CancellationToken. More... | |
LoanedSamples< TRequest > | ReceiveRequests (int minCount, Duration maxWait) |
Receives a number of requests. More... | |
LoanedSamples< TRequest > | TakeRequests () |
Takes all requests. More... | |
LoanedSamples< TRequest > | ReadRequests () |
Reads all requests. More... | |
void | ResetEvents () |
Stop notifying of RequestsAvailable events and remove all its event handlers. More... | |
uint | GetMatchedRequesterCount () |
Gets the number of Requester's that are currently matched with this Replier. More... | |
void | Dispose () |
Releases the native resources used by this object. More... | |
Properties | |
DataReader< TRequest > | RequestReader [get] |
The underlying DataReader<TRequest> used to read requests. More... | |
DataWriter< TReply > | ReplyWriter [get] |
The underlying DataWriter<TReply> used to send replies. More... | |
Action< Replier< TRequest, TReply > > | RequestsAvailable |
Event triggered new requests are available on the Replier. More... | |
Allows receiving requests and sending replies.
TRequest | The type of the requests to be received. |
TReply | The type of the replies to be sent. |
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 are: those generated by the rtiddsgen code generator, the DDS built-in types and Rti.Types.Dynamic.DynamicData.
A Replier has four main types of operations:
For multi-reply scenarios in which a Replier generates more than one reply for a request, the Replier should mark all the intermediate replies (all but the last) using the SampleFlags.IntermediateReplySequence flag in Rti.Dds.Subscription.SampleInfo.Flag.
A Replier 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<TReply> for writing replies and a DataReader<TRequest> for reading requests, are automatically created when the replier is constructed.
Quality of Service for the underlying DataWriter and DataReader can be configured (see ReplierBuilder<TRequest, TReply>.WithDataWriterQos and ReplierBuilder<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.
There are several ways to use a Replier:
Use participant.BuildReplier<TRequest, TReply>()
(an extension method defined in DomainParticipantRequestReplyExtensions) to configure and build a Replier.
For example, to create a basic Replier:
See also Request-Reply Examples.
void Dispose | ( | ) |
Releases the native resources used by this object.
uint GetMatchedRequesterCount | ( | ) |
LoanedSamples<TRequest> ReadRequests | ( | ) |
Reads all requests.
LoanedSamples<TRequest> ReceiveRequests | ( | int | minCount, |
Duration | maxWait | ||
) |
Receives a number of requests.
minCount | The minimum number of requests to wait for. |
maxWait | Maximum time to wait for the requests. |
void ResetEvents | ( | ) |
Stop notifying of RequestsAvailable events and remove all its event handlers.
void SendReply | ( | TReply | reply, |
SampleIdentity | relatedRequestId | ||
) |
Sends a reply to a specific request identified by a SampleIdentity.
reply | The reply to be sent. |
relatedRequestId | Identifies a request previously sent by Requester<TRequest, TReply>.SendRequest(TRequest). |
void SendReply | ( | TReply | reply, |
SampleInfo | relatedRequestInfo | ||
) |
Sends a reply to a specific request identified by a SampleInfo.
reply | The reply to be sent. |
relatedRequestInfo | Identifies a request previously sent by Requester<TRequest, TReply>.SendRequest(TRequest). |
void SendReply | ( | TReply | reply, |
WriteParams | writeParams | ||
) |
Sends a reply.
reply | The reply to be sent. |
writeParams | The parameters to write the reply. |
Other parameters to customize are discussed in DataWriter<T>.Write(T, WriteParams). In particular, Rti.Dds.Publication.WriteParams.Flag can be set to SampleFlags.IntermediateReplySequence to inform the Requester application that this reply will be followed by additional replies to the same request. The Requester can access the flag in Rti.Dds.Subscription.SampleInfo.Flag when it receives the reply.
LoanedSamples<TRequest> TakeRequests | ( | ) |
Takes all requests.
bool WaitForRequests | ( | int | minCount, |
Duration | maxWait | ||
) |
Wait for a number of requests for a duration of time.
minCount | The minimum number of requests to wait for. |
maxWait | Maximum time to wait for the requests. |
async Task<int> WaitForRequestsAsync | ( | int | minCount = 1 , |
CancellationToken | cancellationToken = default |
||
) |
Wait for a number of requests asynchronously until a minimum number of requests reach the Replier, or a cancellation is requested using a CancellationToken.
minCount | The minimum number of requests to wait for. |
cancellationToken | A cancellation token for the wait. |
|
get |
The underlying DataWriter<TReply> used to send replies.
|
get |
The underlying DataReader<TRequest> used to read requests.