diff --git a/client/client_pool/CMakeLists.txt b/client/client_pool/CMakeLists.txt index e310bd13f9..8420368739 100755 --- a/client/client_pool/CMakeLists.txt +++ b/client/client_pool/CMakeLists.txt @@ -11,7 +11,7 @@ target_link_libraries(concord_client_pool PUBLIC bftclient bftclient_new corebft - concord_client_request + concord_client_message ) install (TARGETS concord_client_pool DESTINATION lib${LIB_SUFFIX}) diff --git a/client/client_pool/include/client/client_pool/concord_client_pool.hpp b/client/client_pool/include/client/client_pool/concord_client_pool.hpp index 4c06356d7c..2e661a702f 100644 --- a/client/client_pool/include/client/client_pool/concord_client_pool.hpp +++ b/client/client_pool/include/client/client_pool/concord_client_pool.hpp @@ -120,7 +120,7 @@ class ConcordClientPool { std::string correlation_id = {}, const std::string& span_context = std::string(), const bftEngine::RequestType request_type = bftEngine::RequestType::RAW_MESSAGE, - const std::string& subscriptionId = std::string(), + const std::string& client_service_id = std::string(), const bftEngine::RequestCallBack& callback = {}); // This method is responsible to get write requests with the new client diff --git a/client/client_pool/include/client/client_pool/external_client.hpp b/client/client_pool/include/client/client_pool/external_client.hpp index dc25c1b1a7..0929ae3857 100644 --- a/client/client_pool/include/client/client_pool/external_client.hpp +++ b/client/client_pool/include/client/client_pool/external_client.hpp @@ -21,7 +21,7 @@ #include "client_pool_config.hpp" #include "communication/StatusInfo.h" #include "external_client_exception.hpp" -#include "concord_client_request.cmf.hpp" +#include "concord_client_message.cmf.hpp" namespace concord { @@ -105,11 +105,11 @@ class ConcordClient { std::string messageSignature(bft::client::Msg&); - static void createConcordClientRequest(bft::client::Msg& request, - bftEngine::RequestType typed_request, - const std::string& subscriptionId); + void prepareConcordClientRequest(bft::client::Msg& request, + bftEngine::RequestType request_type, + const std::string& client_service_id); - static void createConcordClientResponse(bft::client::Msg& response); + void prepareConcordClientResponse(bft::client::Msg& response); private: void CreateClient(std::shared_ptr aggregator); diff --git a/client/client_pool/src/concord_client_pool.cpp b/client/client_pool/src/concord_client_pool.cpp index d5e03a575d..bf753653fc 100644 --- a/client/client_pool/src/concord_client_pool.cpp +++ b/client/client_pool/src/concord_client_pool.cpp @@ -45,7 +45,7 @@ SubmitResult ConcordClientPool::SendRequest(std::vector &&request, std::string correlation_id, const std::string &span_context, const bftEngine::RequestType request_type, - const std::string &subscriptionId, + const std::string &client_service_id, const bftEngine::RequestCallBack &callback) { if (callback && timeout_ms.count() == 0) { callback(bftEngine::SendResult{static_cast(OperationResult::INVALID_REQUEST)}); @@ -58,7 +58,8 @@ SubmitResult ConcordClientPool::SendRequest(std::vector &&request, while (!clients_.empty() && serving_candidates != 0) { auto client = clients_.front(); - external_client::ConcordClient::createConcordClientRequest(request, request_type, subscriptionId); + client->prepareConcordClientRequest(request, request_type, client_service_id); + LOG_DEBUG(logger_, "In ConcordClientPool::SendRequest completed packing concord client request to cmf format"); client_id = client->getClientId(); if (is_overloaded_) { is_overloaded_ = false; @@ -494,8 +495,11 @@ void SingleRequestProcessingJob::execute() { OperationResult operation_result = processing_client_->getRequestExecutionResult(); reply_size = res.matched_data.size(); if (callback_) { + logging::Logger logger_(logging::getLogger("com.vmware.SingleRequestProcessingJob")); if (operation_result == OperationResult::SUCCESS) { - external_client::ConcordClient::createConcordClientResponse(res.matched_data); + processing_client_->prepareConcordClientResponse(res.matched_data); + LOG_DEBUG(logger_, + "In SingleRequestProcessingJob::execute completed extracting concord client response from cmf packing"); reply_size = res.matched_data.size(); callback_(res); } else { diff --git a/client/client_pool/src/external_client.cpp b/client/client_pool/src/external_client.cpp index a034686256..8bc4c163b5 100644 --- a/client/client_pool/src/external_client.cpp +++ b/client/client_pool/src/external_client.cpp @@ -195,7 +195,9 @@ std::pair ConcordClient::SendPendingRequ } auto cid = pending_seq_num_to_cid_entry->second; cid_response_map_[cid] = std::chrono::steady_clock::now(); - createConcordClientResponse(received_reply_entry.second.matched_data); + prepareConcordClientResponse(received_reply_entry.second.matched_data); + LOG_DEBUG(logger_, + "In ConcordClient::SendPendingRequests completed extracting concord client response from cmf packing"); auto data_size = received_reply_entry.second.matched_data.size(); for (auto& pending_reply : pending_replies_) { if (pending_reply.cid != cid) continue; @@ -393,20 +395,20 @@ OperationResult ConcordClient::getRequestExecutionResult() { return clientReques std::string ConcordClient::messageSignature(bft::client::Msg& message) { return new_client_->signMessage(message); } -void ConcordClient::createConcordClientRequest(bft::client::Msg& request, - bftEngine::RequestType typed_request, - const std::string& subscriptionId) { - concord::client::request::messages::ConcordClientRequest concord_request; - concord_request.type = static_cast(typed_request); - concord_request.client_id = static_cast(subscriptionId); +void ConcordClient::prepareConcordClientRequest(bft::client::Msg& request, + bftEngine::RequestType request_type, + const std::string& client_service_id) { + concord::client::message::ConcordClientRequest concord_request; + concord_request.request_type = static_cast(request_type); + concord_request.client_service_id = static_cast(client_service_id); concord_request.application_request = std::vector(request.begin(), request.end()); request.clear(); - concord::client::request::messages::serialize(request, concord_request); + concord::client::message::serialize(request, concord_request); } -void ConcordClient::createConcordClientResponse(bft::client::Msg& response) { - concord::client::request::messages::ConcordClientResponse concord_response; - concord::client::request::messages::deserialize(response, concord_response); +void ConcordClient::prepareConcordClientResponse(bft::client::Msg& response) { + concord::client::message::ConcordClientResponse concord_response; + concord::client::message::deserialize(response, concord_response); response.clear(); response.assign(concord_response.application_response.begin(), concord_response.application_response.end()); } diff --git a/client/clientservice/src/request_service.cpp b/client/clientservice/src/request_service.cpp index 2522afb194..4b9a7396e8 100644 --- a/client/clientservice/src/request_service.cpp +++ b/client/clientservice/src/request_service.cpp @@ -170,8 +170,14 @@ void RequestServiceCallData::sendToConcordClient() { this->populateResult(status); return; } + LOG_DEBUG(logger_, + "In RequestServiceCallData::sendToConcordClient callback function done parsing application ANY Data " + "and updated the response"); } else { this->response_.set_raw_response(std::move(data)); + LOG_DEBUG(logger_, + "In RequestServiceCallData::sendToConcordClient callback function done parsing application RAW Data " + "and updated the response"); } this->populateResult(grpc::Status::OK); diff --git a/client/concordclient/CMakeLists.txt b/client/concordclient/CMakeLists.txt index 77718332e2..2446ddef5a 100644 --- a/client/concordclient/CMakeLists.txt +++ b/client/concordclient/CMakeLists.txt @@ -6,7 +6,7 @@ add_subdirectory("cmf") target_link_libraries(concordclient PUBLIC thin_replica_client_lib - concord_client_request + concord_client_message concord_client_pool concordclient-event-api util diff --git a/client/concordclient/cmf/CMakeLists.txt b/client/concordclient/cmf/CMakeLists.txt index b4a8dbe0f7..5937916099 100644 --- a/client/concordclient/cmf/CMakeLists.txt +++ b/client/concordclient/cmf/CMakeLists.txt @@ -1,4 +1,4 @@ -cmf_generate_cpp(header cpp concord::client::request::messages concord_client_request.cmf) -add_library(concord_client_request ${cpp}) -set_target_properties(concord_client_request PROPERTIES LINKER_LANGUAGE CXX) -target_include_directories(concord_client_request PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) +cmf_generate_cpp(header cpp concord::client::message concord_client_message.cmf) +add_library(concord_client_message ${cpp}) +set_target_properties(concord_client_message PROPERTIES LINKER_LANGUAGE CXX) +target_include_directories(concord_client_message PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/client/concordclient/cmf/concord_client_request.cmf b/client/concordclient/cmf/concord_client_message.cmf similarity index 52% rename from client/concordclient/cmf/concord_client_request.cmf rename to client/concordclient/cmf/concord_client_message.cmf index 083ab11b51..33f02f9e34 100644 --- a/client/concordclient/cmf/concord_client_request.cmf +++ b/client/concordclient/cmf/concord_client_message.cmf @@ -2,8 +2,12 @@ # with clientservice specific information to the blockchain network. Msg ConcordClientRequest 1 { - uint32 type - string client_id + # request_type is type of input request, which can be of RAW or ANY request + uint32 request_type + # Client service ID or thin replica client's subscription ID + # used for filtering events for this client. + string client_service_id + # Required application request which gets evaluated by the execution engine. bytes application_request }