Uploaded image for project: 'Jetspeed 2 (Retired)'
  1. Jetspeed 2 (Retired)
  2. JS2-888

Provide a HealthCheck functionality to validate if required resources are (still) available/online, like portlet applications and datasource

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.2.0
    • None
    • None

    Description

      This very useful feature for production environments will provide a dedicated pipeline (by default invokable through /healthcheck) and a corresponding HealthCheckValve.
      The HealthCheckValve is configurable with pluggable HealthCheckValidators to validate availability of specific resources, like required portlet applications and datasources.
      Base implementations for a PortletApplicationAvailableHeathCheckValidator and a DatasourceAvailableHealthCheckValidator will also be provided.

      The default valid/non-valid message returned by the HealthCheckValve (as plain/text) is also configurable allowing dedicated check routines/applications to periodically validate the status of the portal.

      This new pipeline will be integrated and provided out-of-the-box, but by default check nothing, so the portal (if itself alive) will always return the configured "valid" message.
      To make this feature useful, override the portletApplicationValidator and databaseValidator bean definitions in the assembly pipelines.xml

      This feature will also be back-ported to the Jetspeed 2.1.2-POSTRELEASE and 2.1.3-POSTRELEASE branches.

      A (partly commented out) example of this will be added to the pipelines.xml and would be something like this (with in this example the maximum amount of output enabled):

      <bean id="healthCheckValve" class="org.apache.jetspeed.pipeline.valve.HealthCheckValve" init-method="initialize">
      <meta key="j2:cat" value="default" />
      <constructor-arg index="0">
      <!-- Validators -->
      <list>
      <ref bean="portletApplicationValidator" />
      <ref bean="databaseValidator" />
      </list>
      </constructor-arg>
      <constructor-arg index="1">
      <!-- successMessage -->
      <value>THE SERVER IS UP</value>
      </constructor-arg>
      <constructor-arg index="2">
      <!-- failMessage -->
      <value>THE SERVER IS DOWN</value>
      </constructor-arg>
      <constructor-arg index="3">
      <!-- addValidationMessagesToResponse -->
      <value>true</value>
      </constructor-arg>
      <constructor-arg index="4">
      <!-- stopValidationOnError -->
      <value>false</value>
      </constructor-arg>
      </bean>

      <bean id="portletApplicationValidator" class="org.apache.jetspeed.healthcheck.validators.PortletApplicationAvailableHeathCheckValidator">
      <meta key="j2:cat" value="default" />
      <constructor-arg index="0">
      <!-- requiredPortletApplications -->
      <list>
      <!-- names of the portlet applications which are required to be available -->
      <value>j2-admin</value>
      <value>demo</value>
      <value>rss</value>
      </list>
      </constructor-arg>
      <constructor-arg index="1">
      <!-- numberOfRetries -->
      <value>0</value>
      </constructor-arg>
      <constructor-arg index="2">
      <!-- retryDelay -->
      <value>0</value>
      </constructor-arg>
      <constructor-arg index="3">
      <!-- portletRegistry -->
      <ref bean="portletRegistry" />
      </constructor-arg>
      <constructor-arg index="4">
      <!-- portletFactory -->
      <ref bean="portletFactory" />
      </constructor-arg>
      <constructor-arg index="5">
      <!-- stopValidationOnError -->
      <value>true</value>
      </constructor-arg>
      </bean>

      <bean id="databaseValidator" class="org.apache.jetspeed.healthcheck.validators.DatasourceAvailableHealthCheckValidator">
      <meta key="j2:cat" value="default" />
      <constructor-arg index="0">
      <!-- resources -->
      <map>
      <!-- entries to DataSourceValidationBean instances which should be checked
      see (commented out) example below -->
      <entry key="mydata">
      <bean class="org.apache.jetspeed.healthcheck.validators.DataSourcesValidationBean">
      <constructor-arg index="0">
      <!-- Oracle database specific validation query -->
      <value>SELECT * FROM SYS.DUAL</value>
      </constructor-arg>
      <constructor-arg index="1">
      <list>
      <!-- list of datasources (all using the same validation query)
      which needs to be validated -->
      <bean class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:comp/env/jdbc/mydata1"/>
      </bean>
      <bean class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:comp/env/jdbc/mydata2"/>
      </bean>
      </list>
      </constructor-arg>
      </bean>
      </entry>
      </map>
      </constructor-arg>
      <constructor-arg index="1">
      <!-- numberOfRetries -->
      <value>0</value>
      </constructor-arg>
      <constructor-arg index="2">
      <!-- retryDelay -->
      <value>0</value>
      </constructor-arg>
      <constructor-arg index="3">
      <!-- stopValidationOnError -->
      <value>false</value>
      </constructor-arg>
      <constructor-arg index="4">
      <!-- requireAllValid -->
      <value>true</value>
      </constructor-arg>
      </bean>

      Attachments

        Activity

          People

            ate Ate Douma
            ate Ate Douma
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: