0

Bottom-line up front: Is there a way to support non-Java discovery client made instances in Zookeeper, while providing custom metadata.

I'm building a Spring Cloud API Gateway. We're using Zookeeper discovery for most of our routes and Spring Cloud Load Balancer. It works well for Java micro-services. In addition to normal discovery and load balancing, I want to use metadata to specify customization attributes; like security and rate limiting parameters.

I'm needing to introduce some non-Java services written in Python, so I'm wanting to use discovery for those since they're hosted in a dynamic cluster. In this case, continuing to use Zookeeper makes a lot of since for us if I can get it to do what I need.

I've inspected the contents of Zookeeper /services node to see what's going on and I'm able to replicate most of it and actually get discovery and load balancing to work, but the metadata is a level deeper and I can't get that to work, as it's embedded in the Curator/Zookeeper-specific object.

I think I know enough to write my own implementation of DiscoveryClient and return my own ServiceInstances, but that seems like a lot of work if I can almost use what I already have. I'll also have to write the Python client for this as well.

Jeff Walker
  • 1,656
  • 1
  • 18
  • 36

1 Answers1

0

I got around this by re-implementing the InstanceSerializer to manually build the ZookeeperInstance if the ObjectMapper doesn't recognize the ZookeeperInstance automatically.

Jeff Walker
  • 1,656
  • 1
  • 18
  • 36