Client Configuration - Bloomreach Experience - Open Source CMS

This article covers a Hippo CMS version 10. There's an updated version available that covers our most recent release.


Client Configuration

In the previous step you developed a simple REST client to be used in your Hippo project. Typically the connection parameters will be different per environment, i.e. between test, staging and production environments you might want to use different values for baseAddress or connectionTimeout. This page describes how to use a dynamic resouce bundle to make these parameters configurable within the CMS UI, and how to dynamically re-initialize the client when the parameters change by using the Hippo Event Bus.

Add Resouce Bundle Dependency

Add the following dependency to site/pom.xml:


Create a Client Configuration Resource Bundle

Log in to the CMS as admin and create a new document REST Client Configuration of type Resource Bundle in the folder administration/configuration.

In the ID field enter: rest-client-configuration.

Enter the following key, value pairs:

  • client.baseaddress:
  • client.conduit.connection.timeout: 2000
  • client.conduit.receive.timeout: 2500
  • client.path: restapi/topproducts

Publish the resource bundle.

Create a Workflow Event Listener

In your project's site module create a Java class and let it implement  org.hippoecm.hst.core.container.ComponentManagerAware.

In short this class will do the following:

  • Register itself with the HippoEventBus service.
  • Subscribe to  HippoWorkflowEvents.
  • Check each workflow event if it concerns publication of the REST Client Configuration resource bundle.
  • Re-initialize the GoGreenClient if the resource bundle was published.



import java.util.ResourceBundle;

import org.hippoecm.hst.core.container.ComponentManager;
import org.hippoecm.hst.core.container.ComponentManagerAware;
import org.hippoecm.hst.resourcebundle.ResourceBundleFamily;
import org.hippoecm.hst.resourcebundle.internal.HippoRepositoryResourceBundleFamilyFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ClientComponentConfigurationManager implements ComponentManagerAware {

    private static Logger log = LoggerFactory.getLogger(ClientComponentConfigurationManager.class);

    private ComponentManager componentManager;
    private boolean initialized;

    public void setComponentManager(ComponentManager componentManager) {
        this.componentManager = componentManager;

    public void init() {
        HippoServiceRegistry.registerService(this, HippoEventBus.class);

    public void destroy() {
        HippoServiceRegistry.unregisterService(this, HippoEventBus.class);

    public void handleEvent(final HippoWorkflowEvent event) {
        if (event.success() && "default:handle:publish".equals(event.interaction())) {
            if ((event.get("documentPath").toString()
                    .startsWith("/content/documents/administration/configuration/rest-client-configuration"))) {

    public void initialize() {

        //retrieving resource bundle factory component
        HippoRepositoryResourceBundleFamilyFactory familyFactory = componentManager

        //retrieve the gogreen client
        GoGreenClient client = componentManager.getComponent(GoGreenClient.class.getName(), GoGreenClient.class

        //retrieving resourcebundle and values
        final ResourceBundleFamily bundleFamily = familyFactory.createBundleFamily("rest-client-configuration");
        final ResourceBundle rsvpBundle = bundleFamily.getDefaultBundle();

        final String baseAddress = rsvpBundle.getString("client.baseaddress");
        final String path = rsvpBundle.getString("client.path");

        final long receiveTimeout = Long.parseLong(rsvpBundle.getString("client.conduit.receive.timeout"));
        final long connectionTimeout = Long.parseLong(rsvpBundle.getString("client.conduit.connection.timeout"));




Add the following Spring bean configuration file to your project's site module:


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

  <bean class=""


To test the workflow event listener, add the following to conf/log4j-dev.xml:
  <logger name="">
    <level value="info"/>

Then edit and publish the REST Client Configuration resource bundle in the CMS.

If everything works as expected a message similar to the one below will be logged:

08.12.2014 16:13:45 INFO  pool-1-thread-1 [GoGreenClient.init:32] (Re-)Initializing GoGreenClient

Next Step


Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?