Service registry bindings for Netflix Curator
Have you ever set out to do something new, only to find yourself encumbered by a list of prerequisites that must be figured out first? For example, you would like to implement Awesome Feature X in your application. But before doing that you have to figure out how to use a new library. Except the documentation for that library is not very good, or the examples are out of date, or... the list goes on.
Well, you are not alone. I feel that way all the time. Good APIs don’t just do their jobs well--they are also easy to consume.
We are here to help
One of the overarching goals of the Rackspace Service registry (RSR) has been to ease consumption. Some examples:
- The REST API is public, but we maintain open source idiomatic client libraries to help developers including (java, node.js, python, twisted-python).
- We published an integration guide.
- Based on feedback, we removed features that were not useful.
We can do better though. We want it to be super easy to integrate the RSR into your software. To that end, we are looking at ways to integrate the RSR into APIs and interfaces that are already well established.
One API that we use in several places at Rackspace is Netflix Curator. Curator is a value-added wrapper around Apache Zookeeper. Curator recently added some API interfaces that allows programmers to use it as a simple service registry. We think that is a good place to implement application-specific coordination. In this case we wanted to make it easier for programmers to use RSR. We decided to create Curator bindings so that the Netflix API could be used to register services with RSR. The nice thing about the RSR is that all calls are HTTP using a publicly specified API. And of course you also benefit from our fanatical support.
Those bindings have been pushed and you are welcome to try them out now.
If you are already using Curator to register your services, it should be easy to give our the RSR a try. Just follow these steps:
- Make sure you have a Rackspace Cloud Account. You need to know your user name and API key.
- Add the following dependencies to your project
- Instrument your service class with
@Metatags and implement the implied
convertinterface (two methods):
- Replace your
ServiceDiscoveryinstance with a Rackspace instance:
That’s it! Everything else should work the same.
There ere are a few differences you should be aware of:
- RSR will use one thread per client to heartbeat your service. In the case of Curator, this is done by the Curator client instance that is required before you can register services. This should not be a problem for most users, as we have observed that a single process generally maps to a single service.
- Curator and RSR use different means to serialize your service object. Curator serializes the whole thing to
JSON. RSR only serializes the fields you annotate with
A full demonstration project that shows how to use both a Zookeeper-backed registry and a RSR-backed registry can be found among my github projects. Feel free to use it as a jumping off point for your own project integration. Also, the gists from this blog post are all available on github.
We plan more integrations like this. Where it makes sense, we will try to get our work committed upstream.
Our goal is for the RSR to be a building block that can be used by anyone for any application--including applications that do not already use Rackspace products or APIs. If you would like to find out more about how you can use the RSR, fill out this survey, and we’ll get it enabled for your Rackspace Cloud account. Also, we are keen to hear your feedback. If you need help with anything mentioned in this blog post, or are stuck in any way using the RSR, help is only an email away: firstname.lastname@example.org.