Search in sources :

Example 1 with TicketRegistryHealthIndicator

use of org.apereo.cas.monitor.TicketRegistryHealthIndicator in project cas by apereo.

the class CasCoreMonitorConfiguration method sessionHealthIndicator.

@ConditionalOnMissingBean(name = "sessionHealthIndicator")
@Bean
@ConditionalOnEnabledHealthIndicator("sessionHealthIndicator")
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public HealthIndicator sessionHealthIndicator(@Qualifier(TicketRegistry.BEAN_NAME) final TicketRegistry ticketRegistry, final CasConfigurationProperties casProperties) {
    val warnSt = casProperties.getMonitor().getSt().getWarn();
    val warnTgt = casProperties.getMonitor().getTgt().getWarn();
    if (warnSt.getThreshold() > 0 && warnTgt.getThreshold() > 0) {
        LOGGER.debug("Configured session monitor with service ticket threshold [{}] and session threshold [{}]", warnSt.getThreshold(), warnTgt.getThreshold());
        return new TicketRegistryHealthIndicator(ticketRegistry, warnSt.getThreshold(), warnTgt.getThreshold());
    }
    return () -> Health.up().build();
}
Also used : lombok.val(lombok.val) TicketRegistryHealthIndicator(org.apereo.cas.monitor.TicketRegistryHealthIndicator) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnEnabledHealthIndicator(org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

lombok.val (lombok.val)1 TicketRegistryHealthIndicator (org.apereo.cas.monitor.TicketRegistryHealthIndicator)1 ConditionalOnEnabledHealthIndicator (org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1