Does camel-events-support really support for Hippo CMS 12.x

I’m working for the camel-events-support, and its release notes states that the version 1.x supports for Hippo CMS 12.x. But when working with its demo project, I found the problem.

It is something related with site module which uses listener of org.hippoecm.hst.site.container.HstContextLoaderListener in web.xml to configure/initialize/destroy HST Container, and which does not exist in Hippo CMS 10.x. Thus, if I use the listener, I got the following error:

[INFO] [talledLocalContainer] 21:06:28.177 [Thread-5] ERROR org.hippoecm.hst.site.container.DefaultHstSiteConfigurer - HstSiteConfigServlet: ComponentManager initialization failed.

[INFO] [talledLocalContainer] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/org/hippoecm/hst/cmsrest/SpringComponentManager-cmsrest.xml]

[INFO] [talledLocalContainer] Offending resource: file [/Users/tonny/Documents/hippo-workspace/demo/target/tomcat8x/webapps/site/WEB-INF/classes/META-INF/hst-assembly/overrides/hst-cms-rest.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [org/hippoecm/hst/cmsrest/SpringComponentManager-cmsrest.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/hippoecm/hst/cmsrest/SpringComponentManager-cmsrest.xml] cannot be opened because it does not exist

. However, if I remove the listener, the HST Container Services will not be initialized at all.

How can I handle the case please?

Hi Tony,

Unfortunately, the demo sub-project was not upgraded to be compliant with v12 yet. The parent root pom (demo/pom.xml) still inherits from 10.1.0. Sorry for that.

For now, you can create a demo project locally using hippo archetype for your testing and use the forge component somehow.
There are 3 steps:

  1. Instantiate Camel Context

You need to initialize spring web application context and camel Context. See the examples:

  1. Use hippoevt: camel component

Follow https://onehippo-forge.github.io/camel-events-support/component-hippoevent.html to install and use the hippo event support camel component provided by the forge module.
See examples in https://github.com/onehippo-forge/camel-events-support/tree/develop/demo/cms/src/main/webapp/WEB-INF/camel/*.

  1. REST services invoked from the camel route in site

This was just an example in the demo/site:

Your camel route doesn’t have to invoke a REST service, perhaps you can use JCR API or Workflow API or even Content EXIM API to create/update document. But at the moment, the demo includes REST APIs just for simplicity to be invoked from a camel route.

Feel free to let us know how it goes. Also feel free to create a JIRA tickets to improve its demo or documentation in https://issues.onehippo.com/projects/HIPFORGE. Pull requests are more than welcome, too.

Regards,

Woonsan

Hi Woonsan,

Thanks a lot for your kind and rapid reply.

The 3 steps you mentioned is actually what I have done to create a camel route in Hippo CMS, and it really works fine. The following question is how to get the documents’ info, viz. get some subclasses of BaseDocument. The demo sample provides a way to use rest api in site, which, unfortunately, will cause some errors for version 12.x.

For your suggestion to use JCR API or Workflow API etc., I may get wrong knowledge but I’m afraid all this API should be in site module which is just the same module in where all BaseDocument's subclasses exist. Thus, how can camel route in cms module call some API exist in site module?

Wish your further infomation.

Hi Tonny,

I see. You want to take advantage of HST Content Beans.
In that case, I think you can do the following:

Indeed, if you don’t use the HST Content Beans like the old demo, you cannot take advantage of the bean mapping provided by HST-2 unfortunately.
But there are pros and cons. Some pointers:

  • Using HST Content Beans in site webapp, your camel route residing in cms webapp should always make local restapi calls.
  • Even if it is more tedious by not using HST content beans, you can still achieve the integration by using, for example, Content EXIM library [2], to read/update content.

It could be about performance vs modifiability.

Regards,

Woonsan

[1] RESTful API Support - Plain JAX-RS Services - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS
[2] https://onehippo-forge.github.io/content-export-import/

Hi Woonsan,

Thanks a lot for your reply. Actually, I think the demo’s solution is just based on the architecture of Hippo CMS (High Level Component Overview), which shows the Authoring (viz. CMS) can access Delivery (viz. site) via REST API. I’ll let you know if it works according to your guide.

And for Content EXIM library, currently we only run a standalone application, so the local rest api call is just fine for my case.

I see. Sounds good.

Woonsan

Hi Woonsan,

Thanks a lot for your help, and finally it works.

The problem of the demo for Hippo CMS 12.x is just something with how to add restful support in site module. It seems it has got some changes of the aspect, because there’s no folder named bootstrap in 12.x (repo). Eo add restful support there’s an official guide as you mentioned. Actually, there’s a hosts.yaml file located in repository-data/application/src/main/resources/hcm-config/hst which may be have the same function as hosts.xml because I just modified this file and it works.

I’m afraid this is the only point should be changed for the demo to upgrade to Hippo CMS 12.x.

Thanks a lot for your kind help again!

Right. It was changed to repository-data/ from bootstrap/ and .yaml’s from .xml’s. :slight_smile:

Thank YOU very much for reporting and solving the problem together!
I’ve filed a ticket here to fix the demo in the end:

By the nature of ‘forge’, we depend on internal/external voluntary efforts for The Community. So, it would take some time to fix it. I volunteer to fix it with the knowledge found here soon.

Cheers,

Woonsan

Hi Woonsan,

I am also glad to provide any info. if needed to fix the issue.

I’ve fixed the demo in develop branch. It’s now on 12.4.0. After building the module first (snapshot version for now), the demo project can be built and running like the documentation described.
I’ve tested with solr only, but I guess it should work with elasticsearch and ActiveMQ as well because it’s really dependent on very generic integration APIs only with those.
Please feel free to test if anybody is interested in.
I’ll probably cut a new release, v1.2.0, next week.

Cheers,

Woonsan