Java library for Consul HTTP API

2,753 views
Skip to first unread message

Vasily Vasilkov

unread,
Sep 23, 2014, 8:05:37 AM9/23/14
to consu...@googlegroups.com
Hi everyone!

Thank you for Consul, it is a very interesting and useful tool for us here, at Ecwid.

Consul HTTP API is great and very functional, but we need to use it more effectively with our Java-based services. We wrote a Java client for Consul HTTP API, you can find it here: https://github.com/Ecwid/consul-api

Our client supports all HTTP endpoints, all consistency modes and request parameters (tags, datacenters etc.)

Please, feel free to ask any questions, report bugs or make pull requests.

Thank you!

Armon Dadgar

unread,
Sep 23, 2014, 11:20:28 AM9/23/14
to consu...@googlegroups.com, Vasily Vasilkov
Thanks for sharing this! This is the most complete Java client (or even non-Go) client
I think I’ve seen so far. I’ll be sure to point people to this when they ask for a Java client!

Best Regards,
Armon Dadgar
--
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bernd Prager

unread,
Aug 31, 2015, 5:58:15 PM8/31/15
to Consul
Vasily,

Thank you for the API.
Maybe you can add some more documentation, is possible.
I am having trouble with simple string key-value use cases.

Following Java code
ConsulClient client = new ConsulClient("127.0.0.1");
    client.setKVValue("someKey", "someKeyValue");
stores in Consul:
[{"CreateIndex":10299,"ModifyIndex":10376,"LockIndex":0,"Key":"someKey","Flags":0,"Value":"c29tZUtleVZhbHVl"}]
and the Java code:
client.getKVValue("someKey").getValue().getValue();
 

then retrieves the String "c29tZUtleVZhbHVl" instead of "someKeyValue"

What am I missing? How do I retrieve the value?
Thank you!


Ryan Breen

unread,
Aug 31, 2015, 10:02:42 PM8/31/15
to consu...@googlegroups.com
I'm pretty sure I answered this in IRC, but for the record, the step you're missing is un-Base64ing the value.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.

Vasily Vasilkov

unread,
Sep 3, 2015, 8:16:42 AM9/3/15
to consu...@googlegroups.com
Hi Ryan

I will looking into this issue, thank you.
> To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/CAACdaZswePHgnC79Sr9HD%2BpDUVNQ9E3ZK%3DdanaQAVtUoPaGzNA%40mail.gmail.com.

Liang Li

unread,
Oct 27, 2015, 7:09:36 PM10/27/15
to Consul
Ryan is correct.

What you need to do is just decode:

String value = new String(Base64.decodeBase64(client.getKVValue("someKey").getValue().getValue().getBytes());

Tugba Bodrumlu

unread,
Mar 2, 2016, 1:34:59 PM3/2/16
to Consul
Hi,

We have the following problem with the client: https://github.com/Ecwid/consul-api/issues/42.
I also wanted to ask there to see if someone else has encountered such a problem.

Thanks,
Best,
Tugba

haytham...@homedepot.com

unread,
Mar 4, 2017, 10:11:54 AM3/4/17
to Consul, vasily....@gmail.com
Very awesome Consul client, wonder how you do watchers with this library?

Vasily Vasilkov

unread,
Mar 11, 2017, 3:34:32 AM3/11/17
to haytham...@homedepot.com, Consul
Hi,

We still doesn't support watches, please look at this issue - https://github.com/Ecwid/consul-api/issues/19

Asim Parekh

unread,
Jun 21, 2017, 4:53:36 PM6/21/17
to Consul, vasily....@gmail.com
Hello Vasily,
Thanks for the lib. Appreciate it. I am trying to use the JAVA client API (https://github.com/Ecwid/consul-api) in one of my application. I am looking for API documentation for Java Classes in the consul-api-1.2.3.jar. For example, I am using ConsulClient class and looking for documentation on that. I have searched but can't find the docs for it. Would you be kind enough to help me get to the docs please?
Thanks
-Asim
Reply all
Reply to author
Forward
0 new messages