@@ -10,23 +10,89 @@ public interface IRpcClientAddressBuilder : IAddressBuilder<IRpcClientAddressBui
1010 IRpcClientBuilder RpcClient ( ) ;
1111 }
1212
13+ /// <summary>
14+ /// IRpcClientBuilder is the interface for creating an RPC client.
15+ /// See also <seealso cref="IRpcClient"/> and <seealso cref="IRpcServerBuilder"/>
16+ /// </summary>
1317 public interface IRpcClientBuilder
1418 {
19+ /// <summary>
20+ /// Request address where the client sends requests.
21+ /// The server consumes requests from this address.
22+ /// </summary>
23+ /// <returns></returns>
1524 IRpcClientAddressBuilder RequestAddress ( ) ;
25+
26+ /// <summary>
27+ /// The queue from which requests are consumed.
28+ /// if not set the client will create a temporary queue.
29+ /// </summary>
30+ /// <param name="replyToQueueName"> The queue name</param>
31+ /// <returns></returns>
1632 IRpcClientBuilder ReplyToQueue ( string replyToQueueName ) ;
1733
1834 IRpcClientBuilder ReplyToQueue ( IQueueSpecification replyToQueue ) ;
35+
36+ /// <summary>
37+ /// Extracts the correlation id from the request message.
38+ /// each message has a correlation id that is used to match the request with the response.
39+ /// There are default implementations for the correlation id extractor.
40+ /// With this method, you can provide a custom implementation.
41+ /// </summary>
42+ /// <param name="correlationIdExtractor"></param>
43+ /// <returns></returns>
1944 IRpcClientBuilder CorrelationIdExtractor ( Func < IMessage , object > ? correlationIdExtractor ) ;
2045
46+ /// <summary>
47+ /// Post processes the reply message before sending it to the server.
48+ /// The object parameter is the correlation id extracted from the request message.
49+ /// There are default implementations for the reply post processor that use the correlationId() field
50+ /// to set the correlation id of the reply message.
51+ /// With this method, you can provide a custom implementation.
52+ /// </summary>
53+ /// <param name="requestPostProcessor"></param>
54+ /// <returns></returns>
2155 IRpcClientBuilder RequestPostProcessor ( Func < IMessage , object , IMessage > ? requestPostProcessor ) ;
2256
57+ /// <summary>
58+ /// Client and Server must agree on the correlation id.
59+ /// The client will provide the correlation id to send to the server.
60+ /// If the default correlation id is not suitable, you can provide a custom correlation id supplier.
61+ /// Be careful to provide a unique correlation id for each request.
62+ /// </summary>
63+ /// <param name="correlationIdSupplier"></param>
64+ /// <returns></returns>
65+
2366 IRpcClientBuilder CorrelationIdSupplier ( Func < object > ? correlationIdSupplier ) ;
67+
68+ /// <summary>
69+ /// The time to wait for a reply from the server.
70+ /// </summary>
71+ /// <param name="timeout"></param>
72+ /// <returns></returns>
2473 IRpcClientBuilder Timeout ( TimeSpan timeout ) ;
74+ /// <summary>
75+ /// Build and return the RPC client.
76+ /// </summary>
77+ /// <returns></returns>
2578 Task < IRpcClient > BuildAsync ( ) ;
2679 }
2780
81+ /// <summary>
82+ /// IRpcClient is the interface for an RPC client.
83+ /// See also <seealso cref="IRpcServer"/> and <seealso cref="IRpcClientBuilder"/>
84+ /// </summary>
2885 public interface IRpcClient : ILifeCycle
2986 {
87+ /// <summary>
88+ /// PublishAsync sends a request message to the server and blocks the thread until the response is received.
89+ /// The PublishAsync is thread-safe and can be called from multiple threads.
90+ /// The Function returns the response message.
91+ /// If the server does not respond within the timeout, the function throws a TimeoutException.
92+ /// </summary>
93+ /// <param name="message"> The request message</param>
94+ /// <param name="cancellationToken">Cancellation token</param>
95+ /// <returns></returns>
3096 Task < IMessage > PublishAsync ( IMessage message , CancellationToken cancellationToken = default ) ;
3197 }
3298}
0 commit comments