oliora / ppconsul Goto Github PK
View Code? Open in Web Editor NEWC++ client for Consul (http://consul.io)
License: Boost Software License 1.0
C++ client for Consul (http://consul.io)
License: Boost Software License 1.0
Is it possible to get tags for release updates that can be referenced for this library?
Currently, the access token is passed to Consul via query parameter token
as it was the only way to pass it in early versions of Consul. This way of passing the token is now discouraged by Consul. The token should be passed via X-Consul-Token
header instead. See https://www.consul.io/api/index.html#authentication for details.
Currently, ppconsul can be built with one of two two network libraries: libCURL or C++ Network Library. I'm thinking about dropping support for the latter one to simplify adding of TLS support (#12).
Before getting rid of C++ Network Library support I'd like to know how harmful it will be for ppconsul users. Thus I'm asking for feedback on this.
If you use ppconsul with C++ Network Library and have a reason to avoid switching to CURL then please vote for this ticket. I will appreciate if you also add a comment why do you need/want to use a C++ Network Library instead of CURL.
I add key-vals by myself (with python script) and checking what was read after the add.
For example this pair was created:
INFO:root:Key: confidence_thresh ---> Value: 0.65 (READ: b'0.65')
But when Im reading this value thourgh c++ code:
std::vectorstd::string vKeys = m_pKv->keys(strKeysPrefix);
for (auto key : vKeys)
{
auto kvs = m_pKv->item(key);
std::cout << ">>> " << kvs.value << " -> " << kvs.value.size() << " [" << (int)kvs.value.back() - 'a' << "]" << std::endl;
}
I receive the following:
0.65� -> 6 [93]
As you can see there is nothing added to the value. Do you have any thoughts what Im doing wrongly ?
Thank you & best regards
Max
I have the following error when i'm trying to build the current master:
[ 6%] Building CXX object src/CMakeFiles/ppconsul.dir/agent.cpp.o
[ 9%] Building CXX object src/CMakeFiles/ppconsul.dir/catalog.cpp.o
[ 11%] Building CXX object src/CMakeFiles/ppconsul.dir/consul.cpp.o
ppconsul/src/consul.cpp:91:13: error: function 'ppconsul::Consul& ppconsul::Consul::operator=(ppconsul::Consul&&)' defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification ''
Consul& Consul::operator= (Consul &&op) PPCONSUL_NOEXCEPT = default;
^~~~~~
make[2]: *** [src/CMakeFiles/ppconsul.dir/build.make:89: src/CMakeFiles/ppconsul.dir/consul.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:146: src/CMakeFiles/ppconsul.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
Boost 1.73
Could remove the dependency of boost in header files?
Trying to run example
Consul con; Agent ag(con); ag.registerService( name="my-service", port=18747, check=TtlCheck{std::chrono::seconds(5)}
After what I always get Error Message
terminate called after throwing an instance of 'std::runtime_error' what(): Failed to connect to 127.0.0.1 port 8500: Connection refused (7) Aborted (core dumped)
The most recent additions for supporting sessions management causes a failure to build under gcc 4.8 with the following output.
sessions.h:61:21: error: default argument missing for parameter 5 of ‘std::string ppconsul::sessions::Sessions::create(const string&, std::chrono::seconds, ppconsul::sessions::InvalidationBehavior, std::chrono::seconds, const Params& ...)’
std::string create(const std::string &node = "",
I have been using ppconsul for a while now in a project, but I not currently able to upgrade the compiler that is being used. Is it a problem to just remove the default arguments to the create
method
Disable CURLOPT_SSL_VERIFYSTATUS usage in ppconsul if one is build with libcurl older than 7.41.0.
See #12.
I tried to build this project with VS2015.By passing -G "Visual Studio 14 2015 Win64" -DCMAKE_GENERATOR_TOOLSET=v140 -DCMAKE_SYSTEM_VERSION=8.1 flag and curl and boost paths along with -DBUILD_STATIC_LIB=ON in cmake command.After this i was successfully able to generate solution files.But when i tried to build them i am getting below errors.
Severity Code Description Project File Line
Error C2039 'type': is not a member of 'std::enable_if<false,int>' json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2039 'type': is not a member of 'std::enable_if<false,int>' ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' json11 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' ppconsul C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' ppconsul C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' ppconsul C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' ppconsul C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' ppconsul C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' ppconsul C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2139 'json11::Json': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_constructible' ppconsul C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 581
Error C2227 left of '->first' must point to class/struct/union/generic type json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->second' must point to class/struct/union/generic type json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2227 left of '->first' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->first' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->first' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->first' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->first' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->first' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->first' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2227 left of '->second' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2227 left of '->second' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2227 left of '->second' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2227 left of '->second' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2227 left of '->second' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2227 left of '->second' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2227 left of '->second' must point to class/struct/union/generic type ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 100
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 101
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2228 left of '.begin' must have class/struct/union ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 107
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C2535 'json11::Json::Json(const M &)': member function already defined or declared ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 109
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int json11 c:\users\gaurav.kohli\downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 102
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ppconsul C:\Users\gaurav.kohli\Downloads\ppconsul-master\ppconsul-master\ext\json11\json11.hpp 108
On the other hand i am successfully able to build the project with VS2019.
Using cmake command with curl and boost path without _G flag to get solution files.
and cmake --build . command to build project.
Continuation of #67.
Speaking of implementation I think it's better to break compatibility and drop
pair<Config, Member>
in favor of structSelfInfo
with fieldsconfig
,member
andcoord
(the new one).
Originally posted by @oliora in #67 (comment)
Currently it's not possible to build Ppconsul as dynamic library on Windows because dllexport
/dllimport
is not specified (see #24). This need to be fixed.
Hi Andrey,
I ran into you git project (https://github.com/oliora/ppconsul) when I googled 'consul c++ client'.
I wanted to play around with the client that you wrote. However I'm having trouble creating a simple cmake project to link with your library.
Here is what is in main.cpp:
#include <iostream>
#include "ppconsul/agent.h"
int main(int argc, char const *argv[]) {
using namespace ppconsul;
// Create a consul client with using of a default address ("127.0.0.1:8500") and default DC
Consul consul;
// We need the 'agent' endpoint for a service registration
agent::Agent agent(consul);
return 0;
}
Very basic stuff. Here is what my simple CMakeList.txt looks like:
cmake_minimum_required(VERSION 2.8)
project(consuldemo)
#Enable C++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
#On g++ this ensures -std=c++11 and not -std=gnu++11
set(CMAKE_CXX_EXTENSIONS OFF)
include_directories ("${PROJECT_SOURCE_DIR}/ppconsul/include")
FIND_PACKAGE(CURL)
IF(CURL_FOUND)
MESSAGE(STATUS "Curl libraries found at: ${CURL_LIBRARIES}")
MESSAGE(STATUS "Curl includes found at: ${CURL_INCLUDE_DIRS}")
else()
MESSAGE(SEND_ERROR "Could not find cURL on your system")
ENDIF(CURL_FOUND)
add_executable(consuldemo main.cpp)
# set the path to the library folder. libppconsul.a is in /usr/local/lib
link_directories(/usr/local/lib)
target_link_libraries(consuldemo ${CURL_LIBRARIES} json11 ppconsul)
I'm having trouble in the link phase:
//usr/local/lib/libppconsul.a(http_client.cpp.o): In function `ppconsul::curl::(anonymous namespace)::CurlInitializer::CurlInitializer()':
http_client.cpp:(.text+0xb0): undefined reference to `curl_global_init'
....
....
Can you please suggest a best practice simple hello world type CMakeList.txt project which can link against libppconsul.a?
I am able to build the ppconsul cmake project fine so I should have curl installed properly. My cmake project is probably not correct.
Thanks in advance for any help you can provide.
Thanks,
Normin
Hello,
very excited about this project and trying to build master on my dev CentOS machine, but it fails :(
Maybe you can point me to something using this output? Thanks!
[root@mesos-dev ppconsul]# mkdir workspace
[root@mesos-dev ppconsul]# cd workspace/
[root@mesos-dev workspace]# cmake ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/lib64/ccache/cc
-- Check for working C compiler: /usr/lib64/ccache/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib64/ccache/c++
-- Check for working CXX compiler: /usr/lib64/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- GCC 4.8.5 found. Note that using of GCC version less then 4.9 requires to link with Boost.Regex library
-- Boost version: 1.53.0
-- Found the following Boost libraries:
-- regex
-- Found CURL: /usr/local/lib/libcurl.so (found version "7.47.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /root/ppconsul/workspace
[root@mesos-dev workspace]# make
Scanning dependencies of target json11
[ 4%] Building CXX object ext/json11/CMakeFiles/json11.dir/json11.cpp.o
Linking CXX static library ../../output/libjson11.a
[ 4%] Built target json11
Scanning dependencies of target ppconsul
[ 9%] Building CXX object src/CMakeFiles/ppconsul.dir/agent.cpp.o
In file included from /usr/include/boost/fusion/view/transform_view/detail/apply_transform_result.hpp:11:0,
from /usr/include/boost/fusion/view/transform_view/detail/deref_impl.hpp:13,
from /usr/include/boost/fusion/view/transform_view/transform_view_iterator.hpp:14,
from /usr/include/boost/fusion/view/transform_view/transform_view.hpp:14,
from /usr/include/boost/fusion/algorithm/transformation/transform.hpp:10,
from /usr/include/boost/fusion/include/transform.hpp:10,
from /root/ppconsul/include/ppconsul/kwargs.h:32,
from /root/ppconsul/include/ppconsul/parameters.h:9,
from /root/ppconsul/include/ppconsul/consul.h:12,
from /root/ppconsul/include/ppconsul/agent.h:9,
from /root/ppconsul/src/agent.cpp:8:
...
*******HUGE_WALL_OF_TEXT*******
...
make[2]: *** [src/CMakeFiles/ppconsul.dir/agent.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/ppconsul.dir/all] Error 2
make: *** [all] Error 2
Hi Andrey,
I have encountered really weird problem when using ppconsul library.
When my app register to consul server with httpcheck, it always get below error.
(CheckID "service:my-service:XX.XX.XX.Xx:8012" does not have associated TTL [500 Internal Server Error]
and consul server print below error log:
"[ERR] http: Request PUT /v1/agent/check/pass/service%3Amy-service%3A10.237.81.111%3A8012, error: CheckID "service:my-service:XX.XX.XX.XX:8012" does not have associated TTL from=XX.XX.XX.XX:55686"
If I change to TTL check, it works fine. And I stop my service, change back to httpcheck, it magically don't have problem any more. At the whole time, consul server must stay up. If consul server restart, httpcheck will fail to register again.
So the problem is how can I register a service successfully with httpcheck at the first time?
Here is my httpcheck code:
agent.registerService(
kw::name = "my-service",
kw::port = 8012,
kw::id = "my-service:8012",
kw::check = HttpCheck{"http://XX.XX.XX.XX:8012/health", std::chrono::seconds(60)}
);
ttlcheck code:
agent.registerService(
kw::name = "my-service",
kw::port = 8012,
kw::id = "my-service:8012",
kw::check = TtlCheck{std::chrono::seconds(6000)}
);
And my consul server version is v1.0.2.
Look forward for your reply.
Thanks,
Vera
Hello. Doesn't the library support service-specific metadata (https://www.consul.io/api/agent/service.html#meta) or is there a way to assign metadata to a service after registering it ?
Recent additions for adding support to abort pending requests (b75b801) introduced curl symbols CURLOPT_XFERINFOFUNCTION
and CURLOPT_XFERINFODATA
which were introduced with curl 7.32.0 release. Redhat 7 default package for curl is version 7.29 which causes a failure to build.
This is not affecting me personally, however I wanted to create an issue for anyone else that may come across a this problem. It's probably worth just updating the readme to specify a version for the lib curl dependency that is required?
I want to build ppconsul in windows by myself. I found it is very difficult to do it, because needd boots and curl install and so on.
Can you give me a comiled ppconsul libray(dll, lib) form windows to me, I can use ppconsul library in my windows project.
Followon from #29
Version: git revision 6a1a8aa on Centos 7.7.1908
When discovering service info, the "ServiceInfo.meta" map is not populated.
Steps to reproduce:
Expected results:
Address: 10.0.0.1
ID: my-id-001
Name: name1
Port: 1234
Tags:
tagtest2
test1
test3
Metadata:
metakey1=>metaval1
metakey2=>metaval2
secure=>true
Actual results:
Address: 10.0.0.1
ID: my-id-001
Name: name1
Port: 1234
Tags:
tagtest2
test1
test3
Metadata:
Ubuntu 20.04
ppconsul: 0.2.2
g++ 9.4.0
Boost: 1.71.0
CURL: 7.80.0
ctest -C Release
Test project /home/maksim/my/Github/ppconsul/workspace
Start 1: unittests
1/6 Test #1: unittests ........................ Passed 0.02 sec
Start 2: agent-tests
2/6 Test #2: agent-tests ......................***Failed 120.09 sec
Start 3: catalog-tests
3/6 Test #3: catalog-tests ....................***Failed 5.28 sec
Start 4: kv-tests
4/6 Test #4: kv-tests ......................... Passed 6.12 sec
Start 5: sessions-tests
5/6 Test #5: sessions-tests ................... Passed 0.02 sec
Start 6: status-tests
6/6 Test #6: status-tests ..................... Passed 0.02 sec
67% tests passed, 2 tests failed out of 6
Total Test time (real) = 131.54 sec
The following tests FAILED:
2 - agent-tests (Failed)
3 - catalog-tests (Failed)
Errors while running CTest
But if Consul v1.4.2 is used, then the tests pass.
Not available 203.0.113.1
. There is no ping before it. And port 1234
does not open via telnet. Is that how it should be?
Hi,
We have upgraded libcurl and now it supports HTTP/2 protocol.
After the upgrade ppconsul fails if I try to loads keys or items with BadException.
The reason of the failure is the HTTP response did not match with http/2 response (HTTP/2 200).
As a short term solution I made this small change to force HTTP 1.1:
--- a/src/curl/http_client.cpp
+++ b/src/curl/http_client.cpp
@@ -80,6 +80,7 @@ namespace ppconsul { namespace curl {
size_t headerCallback(char *ptr, size_t size_, size_t nitems, void *outputResponse_)
{
+
const auto size = size_ * nitems;
auto outputResponse = reinterpret_cast<CurlHttpClient::GetResponse *>(outputResponse_);
@@ -236,6 +237,7 @@ namespace ppconsul { namespace curl {
setopt(CURLOPT_SSL_VERIFYSTATUS, 1l);
#endif
}
+ setopt(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
}
CurlHttpClient::~CurlHttpClient() = default;
Regards,
make install
and get Ppconsul installed system-wide.With consul 1.0.3+ there are test failures likely due to this change made in the 1.0.3 release: hashicorp/consul#3762
Typical failure:
/Users/cl186051/Consul/ppconsul/tests/agent/agent_checks_tests.cpp:169: FAILED:
due to unexpected exception with message:
400 Bad Request
Hi,
I've read rationales.md but couldn't find a reference why using json11. When I check their repo I notice that they don't have active development, pull requests from 2014 linger there and dropbox/json11#41 seems like they have performance issues. We like to use ppconsul but json11 from the benchmarks seems unreliable. I wanted to ask you if you had any reasons to choose json11? Thanks.
Pulling the most recent changes I have encountered a compiler error on my linux development machine running gcc Ubuntu 5.4.0 with the following error:
src/curl/http_client.h: error: 'unique_ptr' in namespace 'std' does not name a template type std::unique_ptr<CURL, detail::CurlEasyDeleter> m_handle;
Compiling on my OSX machine does not show any errors. After a quick debug I have found that putting #include <memory>
in http_client.h resolves my linux compile issue. Should I just make a PR for this?
Running Ubuntu 16.04 on a VMware instance (virtual machine) on my Macbook Pro.
Running Consul version v0.7.2
I started consul with command: consul agent -dev
Result of running kv-tests:
===============================================================================
test cases: 10 | 2 passed | 8 failed
assertions: 75 | 56 passed | 19 failed
I haven't looked into this deeper, but when using the same Consul object with multiple Kv objects I ran into situations where curl segfaulted consistently.
After changing the code to use a new Consul objects per blocking key-value read, the segfaults went away.
Just leaving this here in case someone else runs into this. Perhaps a note in the documentation on recommended usage of the Consul, Kv classes would be helpful?
Thanks for the library. I've only been looking at it for a couple of days but it has been useful so far. The vcpkg integration made it very easy to integrate.
Hi,
I had the following issue:
I created a watcher object in a separate thread. The watcher made a blocking query on the Consul, and waited for changes.
Problem was on thread desctruction, the join() would wait on the blocking query.
I added a public method in the HttpClient to be able to cancel the request. In the libcurl implementation it is only a setopt(CURLOPT_TIMEOUT_MS, 1), but it seems to work fine.
I have done nothing for the netlib implementation though.
Should I submit a merge request ?
ppconsul does not build on Mac due to the outdated json11. There is a bug in json11 discussed here : dropbox/json11#91
Could you update json11 in your repo ?
Thanks
Is there currently any plan to add support for watches on the various types in consul?
Currently have the need to watch key and or keyprefix for update/creation/delete. I'm willing to help looking at how to add this. I have previously used the java support for this behavior from the orbitz consul-client.
Hello,
I'm a beginner to cpp and trying to use a cpp library called ppconsul(https://github.com/oliora/ppconsul ). This library has dependency to some of other libraries like (boost and curl). I have build ppconsul with all its dependencies and trying to use ppconsul executable in a new project. When I try to build the new project, I'm getting some linker issue like below.
error LNK2001: unresolved external symbol "public: virtual char const * thiscall ppconsul::BadStatus::what(void)const " (?what@BadStatus@ppconsul@@UBEPBDXZ) 1>ConsulApp.obj : error LNK2019: unresolved external symbol "class std::basic_string,class std::allocator > cdecl ppconsul::helpers::encodeUrl(class std::basic_string,class std::allocator > const &)" (?encodeUrl@helpers@ppconsul@@ya?AV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@ABV34@@z) referenced in function "void cdecl ppconsul::parameters::detail::printParameter(class std::basic_ostream > &,class std::basic_string,class std::allocator > const &,struct ppconsul::kw::dc_keyword)" (??$printParameter@Udc_keyword@kw@ppconsul@@@detail@parameters@ppconsul@@YAXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@abv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@4@Udc_keyword@kw@2@@z)
I tried to link the project and change the visual studio but nothing worked. Anybody has any idea about this linker issue? TIA, Prassi
ppconsul should support TLS connections to the Consul. Because security!
When building the ppconsul with "CMAKE_BUILD_TYPE=Debug" or "CMAKE_BUILD_TYPE=RelWithDebInfo". It would be good to have the .pdb (debug symbols) installed along the lib file. Otherwise, the user of the library is confronted with MSVC warnings about the missing .pdb.
In ppconsul this could be achieved so:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c1a0dd8..cff80ce 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -87,6 +87,8 @@ source_group(libb64 FILES ${LIBB64_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${Ppconsul_VERSION}
SOVERSION ${Ppconsul_VERSION}
+ COMPILE_PDB_NAME ${PROJECT_NAME}
+ COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
FOLDER ${PROJECT_NAME}
)
@@ -97,4 +99,11 @@ install(
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
+if(WIN32)
+ install(
+ FILES ${COMPILE_PDB_OUTPUT_DIRECTORY}/${PROJECT_NAME}.pdb
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ OPTIONAL
+ )
+endif()
Note: The ïnstall
of the ppconsul.pdb
is optional, in case e.g. CMAKE_BUILD_TYPE=Release is configured, and no .pdb created.
Make Ppconsul available from Conan.
I have an application that uses a separate thread to watch a KV item's modification by using the block_for parameter with the kv.items(). The timeout is set to be greater than 1 minute. My issue is that when the application receives a signal to terminate (SIGINT) it hangs on the join() for this thread until the KV blocking query timeout is hit.
I don't really want to decrease the blocking query time down to the 1 second range as I don't really want this thread spinning constantly for no reason. I believe my question/issue is related to an older issue, #9.
Any suggestions on how to do this differently or how I can make a PR for additional capability would be great.
Regular expressions are used in one place: to parse HTTP header lines.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.