C.5. Substituting ZooKeeper node contents

download PDF


You can substitute the contents of a ZooKeeper node using the zk property resolver. The property resolver can be specified either as an absolute node:
Or you can reference configuration properties from a specific container using the following syntax:
The preceding syntax is effectively a short cut to the following property resolver:

Recursive variable substitution

It is also possible to use a variable within a variable (recursive substitution). For example, the dosgi profile's resource defines the following property:

How to reference the current version of a resource

A potential problem arises with ZooKeeper property resolver if you need to reference a ZooKeeper node that has a version number embedded in it. For example, suppose you want to reference the my-profile profile's my-resource resource, which can be done using the following ZooKeeper URL:
Notice that the profile version number, 1.0, is embedded in this path. But if you decide to upgrade this profile to version 1.1, this means you must manually edit all occurrences of this ZooKeeper URL, changing the version number to 1.1 in order to reference the upgraded resource. To avoid this extra work, and to ensure that the resolver always references the current version of the resource, you can use the following trick which exploits recursive variable substitution:
This works because the /fabric/configs/containers/${} ZooKeeper node contains the current profile version deployed in the container.
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.