Coder Social home page Coder Social logo

ppconsul's People

Contributors

ik-wg avatar indev29 avatar jgornowich avatar joconnor-openet avatar miseri avatar mparry avatar nekuzyavaya avatar oliora avatar ppietrasa avatar shdown avatar tivnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ppconsul's Issues

no tagged releases

Is it possible to get tags for release updates that can be referenced for this library?

[Vote] Keep support for C++ Network Library

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.

Read value sometimes exists with strange signs at the end of value

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

Can't build anymore

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

Failed to connect to 127.0.0.1 port 8500: Connection refused (7)

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)

Failure to compile with gcc 4.8

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

Failed to build with VS2015.

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.

Add coordinates to `/agent/self`

Continuation of #67.

Speaking of implementation I think it's better to break compatibility and drop pair<Config, Member> in favor of struct SelfInfo with fields config, member and coord (the new one).

Originally posted by @oliora in #67 (comment)

Question about adding ppconsul library to my cmake project

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

Building on CentOS 7

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

register service error:does not have associated TTL

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

Default redhat 7 curl version not comptible

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?

ppconsul windows dll libs

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.

Service metadata not populated in service discovery

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:

  1. start consul: ./consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul -node=agent-one -bind=127.0.0.1 -client=127.0.0.1
  2. add service to consul: ./consul services register -address=10.0.0.1 -port=1234 -id=my-id-001 -name=name1 -kind=my-kind -http-addr=http://127.0.0.1:8500 -meta metakey1=metaval1 -meta metakey2=metaval2 -meta secure=true -tag test1 -tag tagtest2 -tag test3
  3. run attached test program

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: 

Consul v1.11.1 — tests fail

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?

ppconsul with HTTP/2

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,

Add client application example

  • It should be possible to do make install and get Ppconsul installed system-wide.
  • Add client application example (source + CMake config).

test failures with consul 1.0.3+

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

Replace json11 with RapidJSON

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.

unique_ptr compile error with gcc

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?

kv-test unit test fails

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

Consul class recommended/intended usage

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.

Interruptable libcurl connecton

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 ?

Add support for asynchronous callbacks

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.

error LNK2001: unresolved external symbol while trying to build the project

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

No debug symbols installed on Windows

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.

Interrupt blocking query to Key-Value storage

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.