From 03747f780cd55003fad869c6ba93858b92f3de8a Mon Sep 17 00:00:00 2001 From: cyjseagull Date: Fri, 13 Sep 2024 10:57:49 +0800 Subject: [PATCH] update java-sdk wrapper (#32) * update java-sdk wrapper * optimize compile --- cpp/CMakeLists.txt | 9 +- cpp/cmake/Dependencies.cmake | 10 +- cpp/cmake/Options.cmake | 8 + cpp/cmake/TargetSettings.cmake | 5 +- cpp/ppc-framework/Helper.h | 4 +- cpp/ppc-framework/front/FrontConfig.h | 2 + cpp/ppc-framework/front/IFront.h | 140 ++++++++++++++++- cpp/ppc-framework/protocol/Message.h | 38 +++++ cpp/ppc-framework/protocol/MessagePayload.h | 6 + cpp/vcpkg.json | 16 ++ cpp/wedpr-transport/ppc-front/CMakeLists.txt | 2 +- .../ppc-front/ppc-front/Front.cpp | 2 +- .../ppc-front/ppc-front/FrontImpl.cpp | 9 +- .../ppc-front/ppc-front/FrontImpl.h | 4 +- .../ppc-front/ppc-front/PPCChannel.h | 2 - .../ppc-front/ppc-front/PPCChannelManager.h | 2 - .../sdk-wrapper/java/CMakeLists.txt | 11 +- .../sdk-wrapper/java/bindings/build.gradle | 61 ++++---- .../wedpr/sdk/jni/common/JniLibLoader.java | 10 +- .../java/swig/wedpr_java_transport.i | 148 ++++++++++++++++-- cpp/wedpr-transport/sdk/ProTransportImpl.cpp | 12 +- cpp/wedpr-transport/sdk/ProTransportImpl.h | 2 +- cpp/wedpr-transport/sdk/Transport.cpp | 33 ++++ cpp/wedpr-transport/sdk/Transport.h | 30 +++- cpp/wedpr-transport/sdk/TransportBuilder.cpp | 2 +- cpp/wedpr-transport/sdk/TransportBuilder.h | 10 +- cpp/wedpr-transport/sdk/TransportImpl.h | 13 +- 27 files changed, 501 insertions(+), 90 deletions(-) create mode 100644 cpp/wedpr-transport/sdk/Transport.cpp diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index c7c0d094..45d13348 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -72,6 +72,12 @@ set(CEM_SOURCE "") if(BUILD_CEM) set(CEM_SOURCE "wedpr-computing/ppc-cem") endif() + +set(TRANSPORT_SDK_SOURCE_LIST + wedpr-protocol + wedpr-transport/ppc-front + wedpr-transport/sdk wedpr-transport/sdk-wrapper) + set(ALL_SOURCE_LIST ${SDK_SOURCE_LIST} wedpr-crypto/ppc-crypto @@ -92,7 +98,6 @@ if(BUILD_WEDPR_TOOLKIT) include(swig) message(STATUS "Getting SWIG for Windows: ...DONE") endif() - add_subdirectory(wedpr-transport/sdk-wrapper) endif() if(BUILD_ALL) @@ -101,6 +106,8 @@ elseif(BUILD_UDF) add_sources("${UDF_SOURCE_LIST}") elseif(BUILD_SDK) add_sources("${SDK_SOURCE_LIST}") +elseif(BUILD_WEDPR_TOOLKIT) + add_sources("${TRANSPORT_SDK_SOURCE_LIST}") endif() ########### set the sources end ########### diff --git a/cpp/cmake/Dependencies.cmake b/cpp/cmake/Dependencies.cmake index 4a2183ca..d8e1bf62 100644 --- a/cpp/cmake/Dependencies.cmake +++ b/cpp/cmake/Dependencies.cmake @@ -21,17 +21,19 @@ find_package(unofficial-sodium CONFIG REQUIRED) ##### the full-dependencies ##### -if(BUILD_ALL) - find_package(TBB REQUIRED) +if(BUILD_ALL OR BUILD_WEDPR_TOOLKIT) find_package(jsoncpp REQUIRED) - + find_package(TBB REQUIRED) + find_package(gRPC REQUIRED) find_package(${BCOS_BOOSTSSL_TARGET} REQUIRED) +endif() + +if(BUILD_ALL) # tcmalloc include(ProjectTCMalloc) find_package(SEAL REQUIRED) find_package(Kuku REQUIRED) - find_package(gRPC REQUIRED) # APSI: Note: APSI depends on seal 4.0 and Kuku 2.1 include(ProjectAPSI) diff --git a/cpp/cmake/Options.cmake b/cpp/cmake/Options.cmake index 9b092e36..ab319fb3 100644 --- a/cpp/cmake/Options.cmake +++ b/cpp/cmake/Options.cmake @@ -130,10 +130,18 @@ macro(configure_project) set(VISIBILITY_FLAG "") set(BUILD_ALL OFF) endif() + if (BUILD_WEDPR_TOOLKIT) + set(VISIBILITY_FLAG "") + set(BUILD_ALL OFF) + endif() if (BUILD_ALL) # install all dependencies list(APPEND VCPKG_MANIFEST_FEATURES "all") endif() + if (BUILD_WEDPR_TOOLKIT) + # install wedpr dependencies + list(APPEND VCPKG_MANIFEST_FEATURES "toolkit") + endif() if(ENABLE_SSE) # enable sse for libhdfs3 list(APPEND VCPKG_MANIFEST_FEATURES "sse") diff --git a/cpp/cmake/TargetSettings.cmake b/cpp/cmake/TargetSettings.cmake index 1b30601a..47573b12 100644 --- a/cpp/cmake/TargetSettings.cmake +++ b/cpp/cmake/TargetSettings.cmake @@ -140,5 +140,6 @@ set(WEDPR_TRANSPORT_SDK_TARGET wedpr-transport-sdk) set(WEDPR_PYTHON_TRANSPORT "wedpr_python_transport") set(WEDPR_PYTHON_TRANSPORT_DIR ${PROJECT_BINARY_DIR}/python/${WEDPR_PYTHON_TRANSPORT}) -set(WEDPR_JAVA_TRANSPORT "wedpr_java_transport") -set(WEDPR_JAVA_TRANSPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/java/${WEDPR_JAVA_TRANSPORT}) \ No newline at end of file +set(WEDPR_JAVA_TRANSPORT "wedpr_java_transport_jni") +set(WEDPR_JAVA_TRANSPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/java/generated/${WEDPR_JAVA_TRANSPORT}) +set(WEDPR_JAVA_TRANSPORT_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wedpr-transport/sdk-wrapper/java/bindings/src/main/resources/META-INF/native) diff --git a/cpp/ppc-framework/Helper.h b/cpp/ppc-framework/Helper.h index 13f72c46..d084cff7 100644 --- a/cpp/ppc-framework/Helper.h +++ b/cpp/ppc-framework/Helper.h @@ -18,8 +18,8 @@ * @date 2022-10-20 */ #pragma once -#include #include +#include namespace ppc { constexpr static int MAX_PORT = 65535; @@ -42,7 +42,7 @@ inline std::string_view printP2PIDElegantly(std::string_view p2pId) noexcept template inline std::string_view printNodeID(T const& nodeID) { - size_t offset = nodeID.size() >= 8 ? 8 : nodeID.size(); + size_t offset = nodeID.size() >= 15 ? 15 : nodeID.size(); return std::string_view((const char*)nodeID.data(), offset); } } // namespace ppc \ No newline at end of file diff --git a/cpp/ppc-framework/front/FrontConfig.h b/cpp/ppc-framework/front/FrontConfig.h index aa1938da..8af6ca05 100644 --- a/cpp/ppc-framework/front/FrontConfig.h +++ b/cpp/ppc-framework/front/FrontConfig.h @@ -73,6 +73,8 @@ class FrontConfig virtual std::vector const& getComponents() const { return m_components; } void setComponents(std::vector const& components) { m_components = components; } + void addComponent(std::string const& component) { m_components.emplace_back(component); } + std::vector& mutableComponents() { return m_components; } protected: diff --git a/cpp/ppc-framework/front/IFront.h b/cpp/ppc-framework/front/IFront.h index 76cdbcad..1c0c49ea 100644 --- a/cpp/ppc-framework/front/IFront.h +++ b/cpp/ppc-framework/front/IFront.h @@ -41,6 +41,59 @@ class IFrontClient virtual void onReceiveMessage( ppc::protocol::Message::Ptr const& _msg, ppc::protocol::ReceiveMsgFunc _callback) = 0; }; + +///////// the callback definition for sdk wrapper ///////// +class ErrorCallback +{ +public: + using Ptr = std::shared_ptr; + ErrorCallback() = default; + virtual ~ErrorCallback() {} + + virtual void onError(bcos::Error::Ptr error) = 0; +}; + +class MessageDispatcherHandler +{ +public: + using Ptr = std::shared_ptr; + MessageDispatcherHandler() = default; + virtual ~MessageDispatcherHandler() {} + + virtual void onMessage(ppc::protocol::Message::Ptr msg) = 0; +}; + +class SendResponseHandler +{ +public: + using Ptr = std::shared_ptr; + SendResponseHandler(ppc::protocol::SendResponseFunction responseFunc) + : m_responseFunc(responseFunc) + {} + virtual ~SendResponseHandler() {} + + virtual void sendResponse(std::shared_ptr&& payload) + { + m_responseFunc(std::move(payload)); + } + +private: + ppc::protocol::SendResponseFunction m_responseFunc; +}; + +class IMessageHandler +{ +public: + using Ptr = std::shared_ptr; + IMessageHandler() = default; + virtual ~IMessageHandler() {} + + virtual void onMessage(bcos::Error::Ptr e, ppc::protocol::Message::Ptr msg, + SendResponseHandler sendResponseHandler) = 0; +}; + +///////// the callback definition for sdk wrapper ///////// + class IFront : virtual public IFrontClient { public: @@ -71,8 +124,23 @@ class IFront : virtual public IFrontClient virtual void registerTopicHandler( std::string const& topic, ppc::protocol::MessageDispatcherCallback callback) = 0; + /////// to simplify SDK wrapper //// + virtual void registerTopicHandler( + std::string const& topic, MessageDispatcherHandler::Ptr callback) + { + registerTopicHandler(topic, populateMessageDispatcherCallback(callback)); + } + virtual void registerMessageHandler( std::string const& componentType, ppc::protocol::MessageDispatcherCallback callback) = 0; + + /////// to simplify SDK wrapper //// + virtual void registerMessageHandler( + std::string const& componentType, MessageDispatcherHandler::Ptr callback) + { + registerMessageHandler(componentType, populateMessageDispatcherCallback(callback)); + } + /** * @brief async send message * @@ -88,19 +156,53 @@ class IFront : virtual public IFrontClient * @param timeout timeout * @param callback callback */ - virtual void asyncSendMessage(ppc::protocol::RouteType routeType, + virtual void asyncSendMessage(uint16_t routeType, ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload, int seq, long timeout, ppc::protocol::ReceiveMsgFunc errorCallback, ppc::protocol::MessageCallback callback) = 0; + /////// to simplify SDK wrapper //// + + // !!! Note: the 'payload' type(char*) should not been changed, since it used to pass-in java + // byte[] data + virtual void asyncSendMessage(uint16_t routeType, + ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, char* payload, + uint64_t payloadSize, int seq, long timeout, ErrorCallback::Ptr errorCallback, + IMessageHandler::Ptr msgHandler) + { + // TODO: optimize here + bcos::bytes copyedPayload(payload, payload + payloadSize); + asyncSendMessage(routeType, routeInfo, std::move(copyedPayload), seq, timeout, + populateErrorCallback(errorCallback), populateMsgCallback(msgHandler)); + } + virtual void asyncSendResponse(bcos::bytes const& dstNode, std::string const& traceID, bcos::bytes&& payload, int seq, ppc::protocol::ReceiveMsgFunc errorCallback) = 0; + /////// to simplify SDK wrapper //// + + // !!! Note: the 'payload ' type(char*) should not been changed, since it used to pass-in java + // byte[] data + virtual void asyncSendResponse(bcos::bytes const& dstNode, std::string const& traceID, + bcos::bytes&& payload, int seq, ErrorCallback::Ptr errorCallback) + { + asyncSendResponse( + dstNode, traceID, std::move(payload), seq, populateErrorCallback(errorCallback)); + } + // the sync interface for async_send_message - virtual bcos::Error::Ptr push(ppc::protocol::RouteType routeType, + virtual bcos::Error::Ptr push(uint16_t routeType, ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload, int seq, long timeout) = 0; + // TODO: optmize here + virtual bcos::Error::Ptr push(uint16_t routeType, + ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, char* payload, + uint64_t payloadSize, int seq, long timeout) + { + bcos::bytes copyedPayload(payload, payload + payloadSize); + return push(routeType, routeInfo, std::move(copyedPayload), seq, timeout); + } virtual ppc::protocol::Message::Ptr pop(std::string const& topic, long timeoutMs) = 0; virtual ppc::protocol::Message::Ptr peek(std::string const& topic) = 0; @@ -131,6 +233,40 @@ class IFront : virtual public IFrontClient * @param topic the topic to unregister */ virtual bcos::Error::Ptr unRegisterTopic(std::string const& topic) = 0; + + +private: + ppc::protocol::ReceiveMsgFunc populateErrorCallback(ErrorCallback::Ptr errorCallback) + { + if (errorCallback == nullptr) + { + return nullptr; + } + return [errorCallback](bcos::Error::Ptr error) { errorCallback->onError(error); }; + } + + ppc::protocol::MessageDispatcherCallback populateMessageDispatcherCallback( + MessageDispatcherHandler::Ptr handler) + { + if (handler == nullptr) + { + return nullptr; + } + return [handler](ppc::protocol::Message::Ptr msg) { handler->onMessage(msg); }; + } + + ppc::protocol::MessageCallback populateMsgCallback(IMessageHandler::Ptr msgHandler) + { + if (msgHandler == nullptr) + { + return nullptr; + } + return [msgHandler](bcos::Error::Ptr e, ppc::protocol::Message::Ptr msg, + ppc::protocol::SendResponseFunction resFunc) { + SendResponseHandler sendResponseHandler(resFunc); + msgHandler->onMessage(e, msg, sendResponseHandler); + }; + } }; class IFrontBuilder diff --git a/cpp/ppc-framework/protocol/Message.h b/cpp/ppc-framework/protocol/Message.h index 3d78b432..2988fc4b 100644 --- a/cpp/ppc-framework/protocol/Message.h +++ b/cpp/ppc-framework/protocol/Message.h @@ -21,6 +21,7 @@ #include "MessagePayload.h" #include "RouteType.h" #include "ppc-framework/Helper.h" +#include "ppc-framework/libwrapper/Buffer.h" #include #include #include @@ -46,12 +47,34 @@ class MessageOptionalHeader // the source nodeID that send the message virtual bcos::bytes const& srcNode() const { return m_srcNode; } + /// for swig-wrapper(pass the binary data) + OutputBuffer srcNodeBuffer() const + { + // Note: this will be copied to java through jni + return OutputBuffer{(unsigned char*)m_srcNode.data(), m_srcNode.size()}; + } + virtual void setSrcNode(bcos::bytes const& srcNode) { m_srcNode = srcNode; } + // !!! Note: the first paramater type should not been changed, for it's used for pass-in java + // byte[] into c bytes + virtual void setSrcNode(char* data, uint64_t length) { m_srcNode.assign(data, data + length); } + // the target nodeID that should receive the message virtual bcos::bytes const& dstNode() const { return m_dstNode; } + + // for swig-wrapper(pass the binary to java) + OutputBuffer dstNodeBuffer() const + { + // Note: this will be copied to java through jni + return OutputBuffer{(unsigned char*)m_dstNode.data(), m_dstNode.size()}; + } virtual void setDstNode(bcos::bytes const& dstNode) { m_dstNode = dstNode; } + // !!! Note: the first paramater type(char*) should not been changed, for it's used for pass-in + // java byte[] into c bytes + virtual void setDstNode(char* data, uint64_t length) { m_dstNode.assign(data, data + length); } + // the target agency that need receive the message virtual std::string const& dstInst() const { return m_dstInst; } virtual void setDstInst(std::string const& dstInst) { m_dstInst = dstInst; } @@ -184,6 +207,16 @@ class Message : virtual public bcos::boostssl::MessageFace } std::shared_ptr payload() const override { return m_payload; } + // for swig wrapper + OutputBuffer payloadBuffer() const + { + if (!m_payload) + { + return OutputBuffer{nullptr, 0}; + } + return OutputBuffer{(unsigned char*)m_payload->data(), m_payload->size()}; + } + void setPayload(std::shared_ptr _payload) override { m_payload = std::move(_payload); @@ -196,6 +229,11 @@ class Message : virtual public bcos::boostssl::MessageFace MessagePayload::Ptr const& frontMessage() const { return m_frontMessage; } + // Note: swig wrapper require define all methods + virtual bool encode(bcos::bytes& _buffer) = 0; + // encode and return the {header, payload} + virtual bool encode(bcos::boostssl::EncodedMsg& _encodedMsg) = 0; + virtual int64_t decode(bcos::bytesConstRef _buffer) = 0; protected: MessageHeader::Ptr m_header; diff --git a/cpp/ppc-framework/protocol/MessagePayload.h b/cpp/ppc-framework/protocol/MessagePayload.h index f5fbf9e3..a8e6a57c 100644 --- a/cpp/ppc-framework/protocol/MessagePayload.h +++ b/cpp/ppc-framework/protocol/MessagePayload.h @@ -18,6 +18,7 @@ * @date 2024-08-22 */ #pragma once +#include "ppc-framework/libwrapper/Buffer.h" #include #include @@ -42,6 +43,11 @@ class MessagePayload virtual void setVersion(uint8_t version) { m_version = version; } // data virtual bcos::bytes const& data() const { return m_data; } + // for swig wrapper here + virtual OutputBuffer dataBuffer() const + { + return OutputBuffer{(unsigned char*)m_data.data(), m_data.size()}; + } virtual void setData(bcos::bytes&& data) { m_data = std::move(data); } virtual void setData(bcos::bytes const& data) { m_data = data; } // the seq diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index a56cfe04..83449a54 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -103,6 +103,22 @@ "tbb", "libxml2" ] + }, + "toolkit": { + "description": "tooklit dependencies", + "dependencies": [ + { + "name": "bcos-boostssl", + "version>=": "3.2.3" + }, + { + "name": "grpc", + "version>=": "1.51.1" + }, + "tarscpp", + "tbb", + "libxml2" + ] } } } \ No newline at end of file diff --git a/cpp/wedpr-transport/ppc-front/CMakeLists.txt b/cpp/wedpr-transport/ppc-front/CMakeLists.txt index efd94094..8966cbae 100644 --- a/cpp/wedpr-transport/ppc-front/CMakeLists.txt +++ b/cpp/wedpr-transport/ppc-front/CMakeLists.txt @@ -4,7 +4,7 @@ aux_source_directory(ppc-front SRCS) add_library(${FRONT_TARGET} ${SRCS}) -target_link_libraries(${FRONT_TARGET} PUBLIC ${TARS_PROTOCOL_TARGET} TBB::tbb TCMalloc) +target_link_libraries(${FRONT_TARGET} PUBLIC ${TARS_PROTOCOL_TARGET} TBB::tbb) #if (TESTS) # enable_testing() diff --git a/cpp/wedpr-transport/ppc-front/ppc-front/Front.cpp b/cpp/wedpr-transport/ppc-front/ppc-front/Front.cpp index 23dc4dec..7a205b7b 100644 --- a/cpp/wedpr-transport/ppc-front/ppc-front/Front.cpp +++ b/cpp/wedpr-transport/ppc-front/ppc-front/Front.cpp @@ -134,7 +134,7 @@ void Front::asyncSendMessage(const std::string& _agencyID, front::PPCMessageFace }; } // ROUTE_THROUGH_TOPIC will hold the topic - m_front->asyncSendMessage(RouteType::ROUTE_THROUGH_TOPIC, routeInfo, std::move(data), + m_front->asyncSendMessage((uint16_t)RouteType::ROUTE_THROUGH_TOPIC, routeInfo, std::move(data), _message->seq(), _timeout, _callback, msgCallback); } diff --git a/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.cpp b/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.cpp index f88f6bc4..58aae243 100644 --- a/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.cpp +++ b/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.cpp @@ -138,7 +138,7 @@ void FrontImpl::asyncSendResponse(bcos::bytes const& dstNode, std::string const& * @param timeout timeout * @param callback callback */ -void FrontImpl::asyncSendMessage(RouteType routeType, MessageOptionalHeader::Ptr const& routeInfo, +void FrontImpl::asyncSendMessage(uint16_t routeType, MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload, int seq, long timeout, ReceiveMsgFunc errorCallback, MessageCallback callback) { @@ -151,8 +151,9 @@ void FrontImpl::asyncSendMessage(RouteType routeType, MessageOptionalHeader::Ptr m_callbackManager->addCallback(traceID, timeout, callback); auto self = weak_from_this(); // send the message to the gateway - asyncSendMessageToGateway(false, std::move(frontMessage), routeType, traceID, routeInfo, - timeout, [self, traceID, routeInfo, errorCallback](bcos::Error::Ptr error) { + asyncSendMessageToGateway(false, std::move(frontMessage), (ppc::protocol::RouteType)routeType, + traceID, routeInfo, timeout, + [self, traceID, routeInfo, errorCallback](bcos::Error::Ptr error) { auto front = self.lock(); if (!front) { @@ -265,7 +266,7 @@ void FrontImpl::onReceiveMessage(Message::Ptr const& msg, ReceiveMsgFunc callbac } // the sync interface for asyncSendMessage -bcos::Error::Ptr FrontImpl::push(RouteType routeType, MessageOptionalHeader::Ptr const& routeInfo, +bcos::Error::Ptr FrontImpl::push(uint16_t routeType, MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload, int seq, long timeout) { auto promise = std::make_shared>(); diff --git a/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.h b/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.h index ca751374..84000656 100644 --- a/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.h +++ b/cpp/wedpr-transport/ppc-front/ppc-front/FrontImpl.h @@ -52,7 +52,7 @@ class FrontImpl : public IFront, public IFrontClient, public std::enable_shared_ */ void stop() override; - bcos::Error::Ptr push(ppc::protocol::RouteType routeType, + bcos::Error::Ptr push(uint16_t routeType, ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload, int seq, long timeout) override; /** @@ -70,7 +70,7 @@ class FrontImpl : public IFront, public IFrontClient, public std::enable_shared_ * @param timeout timeout * @param callback callback */ - void asyncSendMessage(ppc::protocol::RouteType routeType, + void asyncSendMessage(uint16_t routeType, ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload, int seq, long timeout, ppc::protocol::ReceiveMsgFunc errorCallback, ppc::protocol::MessageCallback callback) override; diff --git a/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannel.h b/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannel.h index f881a915..3f5e4edf 100644 --- a/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannel.h +++ b/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannel.h @@ -23,7 +23,6 @@ #include "Common.h" #include "Front.h" #include "ppc-framework/front/Channel.h" -#include #include namespace ppc::front @@ -43,7 +42,6 @@ class PPCChannel : public Channel, public std::enable_shared_from_this().swap(m_handlers); std::unordered_map().swap(m_messages); - MallocExtension::instance()->ReleaseFreeMemory(); FRONT_LOG(INFO) << LOG_DESC("the PPCChannel destroyed"); } diff --git a/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannelManager.h b/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannelManager.h index 3e4b6bd4..506b2416 100644 --- a/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannelManager.h +++ b/cpp/wedpr-transport/ppc-front/ppc-front/PPCChannelManager.h @@ -21,7 +21,6 @@ #pragma once #include "PPCChannel.h" -#include #include namespace ppc::front @@ -37,7 +36,6 @@ class PPCChannelManager : public std::enable_shared_from_this { std::unordered_map().swap(m_holdingMessages); std::unordered_map().swap(m_channels); - MallocExtension::instance()->ReleaseFreeMemory(); FRONT_LOG(INFO) << LOG_DESC("the PPCChannelManager destroyed"); } diff --git a/cpp/wedpr-transport/sdk-wrapper/java/CMakeLists.txt b/cpp/wedpr-transport/sdk-wrapper/java/CMakeLists.txt index d4d36ffd..9276c9e6 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/CMakeLists.txt +++ b/cpp/wedpr-transport/sdk-wrapper/java/CMakeLists.txt @@ -1,19 +1,22 @@ -file(GLOB_RECURSE SRCS *.i) +file(GLOB_RECURSE SRCS wedpr_java_transport.i) set_source_files_properties(${SRCS} PROPERTIES CPLUSPLUS ON) -set(WEDPR_TRANSPORT_PACKAGE "com.webank.wedpr.sdk.jni.transport") +set(WEDPR_TRANSPORT_PACKAGE "com.webank.wedpr.sdk.jni.generated") set_property(SOURCE swig/wedpr_java_transport.i PROPERTY COMPILE_OPTIONS -package ${WEDPR_TRANSPORT_PACKAGE}) +file(MAKE_DIRECTORY ${WEDPR_JAVA_TRANSPORT_DIR}) +file(MAKE_DIRECTORY ${WEDPR_JAVA_TRANSPORT_LIB_DIR}) + swig_add_library(${WEDPR_JAVA_TRANSPORT} TYPE MODULE LANGUAGE java OUTPUT_DIR ${WEDPR_JAVA_TRANSPORT_DIR} SOURCES ${SRCS}) -SET(LIBRARY_OUTPUT_PATH ${WEDPR_JAVA_TRANSPORT_DIR}) -message("LIBRARY_OUTPUT_PATH: ${WEDPR_JAVA_TRANSPORT_DIR}") +SET(LIBRARY_OUTPUT_PATH ${WEDPR_JAVA_TRANSPORT_LIB_DIR}) +message("LIBRARY_OUTPUT_PATH: ${WEDPR_JAVA_TRANSPORT_LIB_DIR}") set_target_properties(${WEDPR_JAVA_TRANSPORT} PROPERTIES SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON diff --git a/cpp/wedpr-transport/sdk-wrapper/java/bindings/build.gradle b/cpp/wedpr-transport/sdk-wrapper/java/bindings/build.gradle index c455b8ad..bbceb950 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/bindings/build.gradle +++ b/cpp/wedpr-transport/sdk-wrapper/java/bindings/build.gradle @@ -3,9 +3,24 @@ plugins { id 'idea' id 'java-library' id 'maven-publish' - //id 'org.ajoberstar.grgit' version '4.1.1' - //id "de.undercouch.download" version "4.1.2" -// id 'com.github.sherter.google-java-format' version '0.9' + id 'org.ajoberstar.grgit' version '4.1.1' + id "de.undercouch.download" version "4.1.2" + id 'com.github.sherter.google-java-format' version '0.9' +} + +// Additional attribute definition +ext { + if (!project.hasProperty("ossrhUsername")) { + ossrhUsername="xxx" + } + + if (!project.hasProperty("ossrhPassword")) { + ossrhPassword="xxx" + } + lombokVersion = "1.18.32" + junitVersion = "4.13.2" + log4jVersion = "2.23.0" + jmhVersion = "1.36" } println("Notice: current gradle version is " + gradle.gradleVersion) @@ -23,15 +38,15 @@ repositories { mavenLocal() } -// googleJavaFormat { -// toolVersion = '1.7' -// options style: 'AOSP' -// source = sourceSets*.allJava -// include '**/*.java' -// exclude '**/*Test.java' -// exclude '**/Test*.java' -// exclude '**/Mock*.java' -// } + googleJavaFormat { + toolVersion = '1.7' + options style: 'AOSP' + source = sourceSets*.allJava + include '**/*.java' + exclude '**/*Test.java' + exclude '**/Test*.java' + exclude '**/Mock*.java' + } sourceSets { main { @@ -61,28 +76,20 @@ sourceSets { dependencies { api ('org.slf4j:slf4j-api:1.7.36') - jmhImplementation 'org.openjdk.jmh:jmh-core:1.36' - jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.36' + implementation("org.projectlombok:lombok:${lombokVersion}") + jmhImplementation ("org.openjdk.jmh:jmh-core:${jmhVersion}") + jmhAnnotationProcessor ("org.openjdk.jmh:jmh-generator-annprocess:${jmhVersion}") + + testImplementation ("org.slf4j:slf4j-log4j12:${log4jVersion}") + testImplementation ("junit:junit:${junitVersion}") - testImplementation ('org.slf4j:slf4j-log4j12:1.7.36') - testImplementation ('junit:junit:4.13.2') + annotationProcessor("org.projectlombok:lombok:${lombokVersion}") } archivesBaseName = 'wedpr-java-transport-jni' group = 'com.webank.wedpr' version = '1.0.0' -// Additional attribute definition -ext { - if (!project.hasProperty("ossrhUsername")) { - ossrhUsername="xxx" - } - - if (!project.hasProperty("ossrhPassword")) { - ossrhPassword="xxx" - } -} - jar { exclude '**/*.xml' exclude '**/*.properties' diff --git a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/common/JniLibLoader.java b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/common/JniLibLoader.java index 9af0301e..f30e9165 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/common/JniLibLoader.java +++ b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/common/JniLibLoader.java @@ -37,7 +37,7 @@ public final class JniLibLoader { public static final String MAC = "mac"; public static final String WIN = "win"; - public static final String NATIVE_RESOURCE_LIB_NAME = "wedpr-java-transport-jni"; + public static final String NATIVE_RESOURCE_LIB_NAME = "wedpr_java_transport_jni"; public static final String NATIVE_RESOURCE_HOME = "/META-INF/native"; public static final String NATIVE_WIN_DEPS_DIR = NATIVE_RESOURCE_HOME + "/win/"; public static final String WIN_DEPS_FILE_LIST = "file.list"; @@ -51,13 +51,13 @@ public final class JniLibLoader { // 1. initialize workdir // -Dcom.webank.wedpr.workdir - String workdir = System.getProperty("com.webank.wedpr.workdir"); + String workdir = System.getProperty("com.webank.wedpr.sdk.jni.workdir"); if (workdir != null) { try { File f = new File(workdir); f.mkdirs(); WORKDIR = f; - logger.info("initialize workdir, -Dcom.webank.wedpr.workdir: {}", WORKDIR); + logger.info("initialize workdir, -Dcom.webank.wedpr.sdk.jni.workdir: {}", WORKDIR); } catch (Exception e) { logger.debug("initialize workdir, cannot mkdir workdir: {}, e: ", workdir, e); workdir = null; @@ -101,9 +101,9 @@ public static String getLibName(String baseName) { } else if (osName.contains(MAC)) { String arch = getArch(); if ("arm".equals(arch)) { - return "lib" + baseName + "-aarch64" + ".dylib"; + return "lib" + baseName + "-aarch64" + ".jnilib"; } - return "lib" + baseName + ".dylib"; + return "lib" + baseName + ".jnilib"; } else { throw new RuntimeException("unrecognized OS: " + osName); } diff --git a/cpp/wedpr-transport/sdk-wrapper/java/swig/wedpr_java_transport.i b/cpp/wedpr-transport/sdk-wrapper/java/swig/wedpr_java_transport.i index 05a504c8..35dfdd9b 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/swig/wedpr_java_transport.i +++ b/cpp/wedpr-transport/sdk-wrapper/java/swig/wedpr_java_transport.i @@ -1,4 +1,4 @@ -%module wedpr_java_transport +%module(directors="1") wedpr_java_transport %include "stdint.i" %include "typemaps.i" @@ -25,50 +25,178 @@ PRIMITIVE_TYPEMAP(unsigned long int, long long); #endif // defined(SWIGWORDSIZE64) #endif // defined(SWIGJAVA) + %include %include %include %include %include +%include - +// shared_ptr definition %shared_ptr(ppc::front::FrontConfig); +%shared_ptr(ppc::front::IFront); +%shared_ptr(ppc::front::IFrontClient); +// the callbacks +%shared_ptr(ppc::front::ErrorCallback); +%shared_ptr(ppc::front::MessageDispatcherHandler); +%shared_ptr(ppc::front::IMessageHandler); + +%shared_ptr(ppc::gateway::IGateway); %shared_ptr(bcos::Error); +%shared_ptr(bcos::bytes); %shared_ptr(ppc::protocol::Message); -%shared_ptr(ppc::protocol::MessageOptionalHeader) +%shared_ptr(ppc::protocol::MessageOptionalHeader); +%shared_ptr(ppc::protocol::MessageHeader); +%shared_ptr(ppc::protocol::MessagePayload); +%shared_ptr(ppc::protocol::MessageBuilder); +%shared_ptr(ppc::protocol::MessageHeaderBuilder); +%shared_ptr(ppc::protocol::MessagePayloadBuilder); +%shared_ptr(ppc::protocol::MessageOptionalHeaderBuilder); +%shared_ptr(ppc::protocol::GrpcConfig); %shared_ptr(ppc::sdk::Transport); + %{ #define SWIG_FILE_WITH_INIT +#include +#include #include #include "wedpr-transport/sdk/TransportBuilder.h" #include "wedpr-transport/sdk/Transport.h" +#include "ppc-framework/libwrapper/Buffer.h" #include "ppc-framework/front/IFront.h" #include "ppc-framework/protocol/RouteType.h" #include "ppc-framework/front/FrontConfig.h" +#include "ppc-framework/protocol/GrpcConfig.h" #include +#include "ppc-framework/protocol/EndPoint.h" +#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/MessagePayload.h" %} +namespace ppc::sdk{ + class Transport; + class TransportBuilder; +} + +namespace ppc::gateway{ + class IGateway; +} + +namespace ppc::protocol{ + class Message; + class MessageHeader; + class MessagePayload; + class MessageOptionalHeader; + class MessageBuilder; + class MessageHeaderBuilder; + class MessagePayloadBuilder; + class MessageOptionalHeaderBuilder; + class EndPoint; + class GrpcConfig; + class RouteType; +} + namespace ppc::front{ class FrontConfig; class IFront; + class IFrontClient; class FrontImpl; class FrontBuilderImpl; - class RouteType; class GatewayEndPoint; + class ErrorCallback; + class MessageDispatcherHandler; + class IMessageHandler; + class SendResponseHandler; } -namespace ppc::sdk{ - class Transport; - class TransportBuilder; +namespace std{ + class vector; } -%template(SharedFrontConfig) std::shared_ptr; +namespace bcos{ + using byte = uint8_t; + using bytes = std::vector; + class Error; +} + +// define shared_ptr objects %template(SharedBcosError) std::shared_ptr; + +%template(SharedFrontConfig) std::shared_ptr; +%template(SharedGrpcConfig) std::shared_ptr; + +%template(SharedFront) std::shared_ptr; +%template(SharedFrontClient) std::shared_ptr; + +%template(SharedErrorCallback) std::shared_ptr; +%template(SharedMessageDispatcherHandler) std::shared_ptr; +%template(SharedIMessageHandler) std::shared_ptr; + +%template(SharedGateway) std::shared_ptr; + %template(SharedMessage) std::shared_ptr; +%template(SharedMessageHeader) std::shared_ptr; +%template(SharedMessagePayload) std::shared_ptr; %template(SharedRouteInfo) std::shared_ptr; -%template(SharedTransport) std::shared_ptr; + +%template(SharedMessageBuilder) std::shared_ptr; +%template(SharedMessageHeaderBuilder) std::shared_ptr; +%template(SharedMessagePayloadBuilder) std::shared_ptr; +%template(SharedRouteInfoBuilder) std::shared_ptr; + +%template(ubytes) std::vector; +%template(ibytes) std::vector; + +/// callbacks +%feature("director") ppc::front::ErrorCallback; +%feature("director") ppc::front::MessageDispatcherHandler; +%feature("director") ppc::front::IMessageHandler; + +// Note: the field data should equal to the fieldMap of class or the function +%include various.i +// this means convert all (char*) to byte[] +%apply char *BYTE {char * }; + + +%typemap(jni) OutputBuffer "jbyteArray" +%typemap(jtype) OutputBuffer "byte[]" +%typemap(jstype) OutputBuffer "byte[]" +%typemap(in) OutputBuffer { + $1.data = (unsigned char *) JCALL2(GetByteArrayElements, jenv, $input, 0); + $1.len = JCALL1(GetArrayLength, jenv, $input); +} +%typemap(argout) OutputBuffer { + JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *) $1.data, 0); +} +// Note: will cause copy herer +%typemap(out) OutputBuffer { + $result = JCALL1(NewByteArray, jenv, $1.len); + JCALL4(SetByteArrayRegion, jenv, $result, 0, $1.len, (jbyte *) $1.data); + delete[] $1.data; +} +%typemap(javain) OutputBuffer "$javainput" +%typemap(javaout) OutputBuffer { return $jnicall; } + +/* +///// tests /// +%inline { +} +///// tests /// +*/ + +// define the interface should been exposed +%include "bcos-utilities/Error.h" +%include "ppc-framework/libwrapper/Buffer.h" +%include "ppc-framework/front/FrontConfig.h" +%include "ppc-framework/protocol/EndPoint.h" +%include "ppc-framework/protocol/GrpcConfig.h" +%include "ppc-framework/protocol/Message.h" +%include "ppc-framework/protocol/MessagePayload.h" + +%include "ppc-framework/front/IFront.h" %include "wedpr-transport/sdk/TransportBuilder.h" %include "wedpr-transport/sdk/Transport.h" -%include "ppc-framework/front/IFront.h" \ No newline at end of file + diff --git a/cpp/wedpr-transport/sdk/ProTransportImpl.cpp b/cpp/wedpr-transport/sdk/ProTransportImpl.cpp index 3763e339..b2a50563 100644 --- a/cpp/wedpr-transport/sdk/ProTransportImpl.cpp +++ b/cpp/wedpr-transport/sdk/ProTransportImpl.cpp @@ -19,7 +19,6 @@ */ #include "ProTransportImpl.h" #include "Common.h" -#include "protocol/src/v1/MessageImpl.h" #include "wedpr-protocol/grpc/client/GatewayClient.h" #include "wedpr-protocol/grpc/server/FrontServer.h" #include "wedpr-protocol/grpc/server/GrpcServer.h" @@ -30,7 +29,7 @@ using namespace ppc::sdk; ProTransportImpl::ProTransportImpl(ppc::front::FrontConfig::Ptr config, int keepAlivePeriodMs) - : m_config(std::move(config)), m_keepAlivePeriodMs(keepAlivePeriodMs) + : Transport(config), m_keepAlivePeriodMs(keepAlivePeriodMs) { // Note: since the config has been moved away, should not use the `config`, use `m_config` // instead default enable health-check @@ -40,13 +39,10 @@ ProTransportImpl::ProTransportImpl(ppc::front::FrontConfig::Ptr config, int keep FrontFactory frontFactory; m_gateway = std::make_shared(m_config->grpcConfig(), m_config->gatewayGrpcTarget()); - m_front = frontFactory.build(std::make_shared(), - std::make_shared(), - std::make_shared(), m_gateway, m_config); + m_front = frontFactory.build(std::make_shared(), m_msgPayloadBuilder, + m_routeInfoBuilder, m_gateway, m_config); - auto msgBuilder = - std::make_shared(std::make_shared()); - m_frontService = std::make_shared(msgBuilder, m_front); + m_frontService = std::make_shared(m_msgBuilder, m_front); // register the frontService m_server->registerService(m_frontService); } diff --git a/cpp/wedpr-transport/sdk/ProTransportImpl.h b/cpp/wedpr-transport/sdk/ProTransportImpl.h index 76e2ce3a..cb5d4873 100644 --- a/cpp/wedpr-transport/sdk/ProTransportImpl.h +++ b/cpp/wedpr-transport/sdk/ProTransportImpl.h @@ -20,6 +20,7 @@ #pragma once #include "TransportImpl.h" #include "bcos-utilities/Timer.h" +#include "protocol/src/v1/MessageImpl.h" namespace ppc::protocol { @@ -43,7 +44,6 @@ class ProTransportImpl : public Transport, public std::enable_shared_from_this

m_server; std::shared_ptr m_frontService; int m_keepAlivePeriodMs; diff --git a/cpp/wedpr-transport/sdk/Transport.cpp b/cpp/wedpr-transport/sdk/Transport.cpp new file mode 100644 index 00000000..ea7b112f --- /dev/null +++ b/cpp/wedpr-transport/sdk/Transport.cpp @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2023 WeDPR. + * SPDX-License-Identifier: Apache-2.0 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @file Transport.cpp + * @author: yujiechen + * @date 2024-09-04 + */ +#include "Transport.h" +#include "protocol/src/v1/MessageHeaderImpl.h" +#include "protocol/src/v1/MessageImpl.h" +#include "protocol/src/v1/MessagePayloadImpl.h" + +using namespace ppc::sdk; + +Transport::Transport(ppc::front::FrontConfig::Ptr config) + : m_config(std::move(config)), + m_msgPayloadBuilder(std::make_shared()), + m_msgHeaderBuilder(std::make_shared()), + m_msgBuilder(std::make_shared(m_msgHeaderBuilder)), + m_routeInfoBuilder(std::make_shared()) +{} diff --git a/cpp/wedpr-transport/sdk/Transport.h b/cpp/wedpr-transport/sdk/Transport.h index c9c36148..c6175c91 100644 --- a/cpp/wedpr-transport/sdk/Transport.h +++ b/cpp/wedpr-transport/sdk/Transport.h @@ -18,15 +18,19 @@ * @date 2024-09-04 */ #pragma once +#include "ppc-framework/front/FrontConfig.h" #include "ppc-framework/front/IFront.h" #include "ppc-framework/gateway/IGateway.h" +#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/MessagePayload.h" + namespace ppc::sdk { class Transport { public: using Ptr = std::shared_ptr; - Transport() = default; + Transport(ppc::front::FrontConfig::Ptr config); virtual ~Transport() = default; virtual void start() { m_front->start(); } @@ -36,8 +40,32 @@ class Transport virtual ppc::gateway::IGateway::Ptr const& gateway() const { return m_gateway; } + virtual ppc::protocol::MessagePayloadBuilder::Ptr const& msgPayloadBuilder() const + { + return m_msgPayloadBuilder; + } + virtual ppc::protocol::MessageBuilder::Ptr const& msgBuilder() const { return m_msgBuilder; } + virtual ppc::protocol::MessageHeaderBuilder::Ptr const& msgHeaderBuilder() const + { + return m_msgHeaderBuilder; + } + + virtual ppc::protocol::MessageOptionalHeaderBuilder::Ptr const& routeInfoBuilder() const + { + return m_routeInfoBuilder; + } + + virtual ppc::front::FrontConfig::Ptr const& getConfig() const { return m_config; } + protected: ppc::front::IFront::Ptr m_front; ppc::gateway::IGateway::Ptr m_gateway; + + ppc::front::FrontConfig::Ptr m_config; + + ppc::protocol::MessageHeaderBuilder::Ptr m_msgHeaderBuilder; + ppc::protocol::MessagePayloadBuilder::Ptr m_msgPayloadBuilder; + ppc::protocol::MessageOptionalHeaderBuilder::Ptr m_routeInfoBuilder; + ppc::protocol::MessageBuilder::Ptr m_msgBuilder; }; } // namespace ppc::sdk \ No newline at end of file diff --git a/cpp/wedpr-transport/sdk/TransportBuilder.cpp b/cpp/wedpr-transport/sdk/TransportBuilder.cpp index cec1a6aa..f0cc6a5b 100644 --- a/cpp/wedpr-transport/sdk/TransportBuilder.cpp +++ b/cpp/wedpr-transport/sdk/TransportBuilder.cpp @@ -36,7 +36,7 @@ TransportBuilder::TransportBuilder() } Transport::Ptr TransportBuilder::build( - SDKMode mode, ppc::front::FrontConfig::Ptr config, ppc::gateway::IGateway::Ptr const& gateway) + SDKMode mode, ppc::front::FrontConfig::Ptr config, ppc::gateway::IGateway::Ptr gateway) { switch (mode) { diff --git a/cpp/wedpr-transport/sdk/TransportBuilder.h b/cpp/wedpr-transport/sdk/TransportBuilder.h index cd6c3c56..d8ffa95b 100644 --- a/cpp/wedpr-transport/sdk/TransportBuilder.h +++ b/cpp/wedpr-transport/sdk/TransportBuilder.h @@ -36,8 +36,14 @@ class TransportBuilder TransportBuilder(); virtual ~TransportBuilder() = default; - Transport::Ptr build(SDKMode mode, ppc::front::FrontConfig::Ptr config, - ppc::gateway::IGateway::Ptr const& gateway); + Transport::Ptr build( + SDKMode mode, ppc::front::FrontConfig::Ptr config, ppc::gateway::IGateway::Ptr gateway); + + // Note: the swig-wrapper can't receive the null shared_ptr + Transport::Ptr buildProTransport(ppc::front::FrontConfig::Ptr config) + { + return build(SDKMode::PRO, config, nullptr); + } ppc::front::FrontConfig::Ptr buildConfig(int threadPoolSize, std::string nodeID); diff --git a/cpp/wedpr-transport/sdk/TransportImpl.h b/cpp/wedpr-transport/sdk/TransportImpl.h index fbd9e3e6..5ebda37b 100644 --- a/cpp/wedpr-transport/sdk/TransportImpl.h +++ b/cpp/wedpr-transport/sdk/TransportImpl.h @@ -22,8 +22,7 @@ #include "ppc-framework/gateway/IGateway.h" #include "ppc-front/FrontFactory.h" #include "protobuf/src/NodeInfoImpl.h" -#include "protocol/src/v1/MessageHeaderImpl.h" -#include "protocol/src/v1/MessagePayloadImpl.h" + namespace ppc::sdk { @@ -31,17 +30,15 @@ class TransportImpl : public Transport { public: TransportImpl(ppc::front::FrontConfig::Ptr config, ppc::gateway::IGateway::Ptr const& gateway) - : m_config(std::move(config)) + : Transport(config) + { m_gateway = gateway; + ppc::front::FrontFactory frontFactory; m_front = frontFactory.build(std::make_shared(), - std::make_shared(), - std::make_shared(), gateway, m_config); + m_msgPayloadBuilder, m_routeInfoBuilder, gateway, m_config); } ~TransportImpl() override = default; - -protected: - ppc::front::FrontConfig::Ptr m_config; }; } // namespace ppc::sdk