@@ -99,17 +99,19 @@ struct RpcClient::ExpireService {
9999
100100// //////////////////////////////////////////////////////////////////////////////
101101RpcClient::RpcClient (std::shared_ptr<transport::UTransport> transport,
102- v1::UUri&& method, v1::UPriority priority,
103- std::chrono::milliseconds ttl,
102+ v1::UPriority priority, std::chrono::milliseconds ttl,
104103 std::optional<v1::UPayloadFormat> payload_format,
105104 std::optional<uint32_t > permission_level,
106105 std::optional<std::string> token)
107106 : transport_(std::move(transport)),
108107 ttl_ (ttl),
109- builder_(datamodel::builder::UMessageBuilder::request (
110- std::move (method) , v1::UUri(transport_->getEntityUri ()), priority ,
111- ttl_ )),
108+ builder_(datamodel::builder::UMessageBuilder(
109+ v1::UMESSAGE_TYPE_REQUEST , v1::UUri(transport_->getEntityUri ()),
110+ v1::UUri{} )),
112111 expire_service_(std::make_unique<ExpireService>()) {
112+ builder_.withPriority (priority);
113+ builder_.withTtl (ttl);
114+
113115 if (payload_format) {
114116 builder_.withPayloadFormat (*payload_format);
115117 }
@@ -204,41 +206,44 @@ RpcClient::InvokeHandle RpcClient::invokeMethod(v1::UMessage&& request,
204206}
205207
206208RpcClient::InvokeHandle RpcClient::invokeMethod (
207- datamodel::builder::Payload&& payload, Callback&& callback) {
208- return invokeMethod (builder_.build (std::move (payload)),
209+ const v1::UUri& method, datamodel::builder::Payload&& payload,
210+ Callback&& callback) {
211+ return invokeMethod (builder_.withMethod (method).build (std::move (payload)),
209212 std::move (callback));
210213}
211214
212- RpcClient::InvokeHandle RpcClient::invokeMethod (Callback&& callback) {
213- return invokeMethod (builder_.build (), std::move (callback));
215+ RpcClient::InvokeHandle RpcClient::invokeMethod (const v1::UUri& method,
216+ Callback&& callback) {
217+ return invokeMethod (builder_.withMethod (method).build (),
218+ std::move (callback));
214219}
215220
216221RpcClient::InvokeFuture RpcClient::invokeMethod (
217- datamodel::builder::Payload&& payload) {
222+ const v1::UUri& method, datamodel::builder::Payload&& payload) {
218223 // Note: functors need to be copy constructable. We work around this by
219224 // wrapping the promise in a shared_ptr. Unique access to it will be
220225 // assured by the implementation at the core of invokeMethod - it only
221226 // allows exactly one call to the callback via std::call_once.
222227 auto promise = std::make_shared<std::promise<MessageOrStatus>>();
223228 auto future = promise->get_future ();
224229 auto handle =
225- invokeMethod (std::move (payload),
230+ invokeMethod (method, std::move (payload),
226231 [promise](const MessageOrStatus& maybe_message) mutable {
227232 promise->set_value (maybe_message);
228233 });
229234
230235 return {std::move (future), std::move (handle)};
231236}
232237
233- RpcClient::InvokeFuture RpcClient::invokeMethod () {
238+ RpcClient::InvokeFuture RpcClient::invokeMethod (const v1::UUri& method ) {
234239 // Note: functors need to be copy constructable. We work around this by
235240 // wrapping the promise in a shared_ptr. Unique access to it will be
236241 // assured by the implementation at the core of invokeMethod - it only
237242 // allows exactly one call to the callback via std::call_once.
238243 auto promise = std::make_shared<std::promise<MessageOrStatus>>();
239244 auto future = promise->get_future ();
240- auto handle =
241- invokeMethod ( [promise](const MessageOrStatus& maybe_message) mutable {
245+ auto handle = invokeMethod (
246+ method, [promise](const MessageOrStatus& maybe_message) mutable {
242247 promise->set_value (maybe_message);
243248 });
244249
0 commit comments