com.solace.spring.cloud.stream.binder.config.SolaceHealthIndicatorsConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-cloud-stream-binder-solace Show documentation
Show all versions of spring-cloud-stream-binder-solace Show documentation
A Spring Cloud Stream Binder implementation using the Solace Java API (JCSMP)
The newest version!
package com.solace.spring.cloud.stream.binder.config;
import com.solace.spring.cloud.stream.binder.health.SolaceBinderHealthAccessor;
import com.solace.spring.cloud.stream.binder.health.contributors.BindingsHealthContributor;
import com.solace.spring.cloud.stream.binder.health.contributors.SolaceBinderHealthContributor;
import com.solace.spring.cloud.stream.binder.health.handlers.SolaceSessionEventHandler;
import com.solace.spring.cloud.stream.binder.health.indicators.SessionHealthIndicator;
import com.solace.spring.cloud.stream.binder.properties.SolaceSessionHealthProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
@ConditionalOnClass(name = "org.springframework.boot.actuate.health.HealthIndicator")
@ConditionalOnEnabledHealthIndicator("binders")
@EnableConfigurationProperties({SolaceSessionHealthProperties.class})
@ConditionalOnProperty(name = "solace.java.host")
public class SolaceHealthIndicatorsConfiguration {
@Bean
public SolaceBinderHealthAccessor solaceBinderHealthAccessor(
SolaceBinderHealthContributor solaceBinderHealthContributor) {
return new SolaceBinderHealthAccessor(solaceBinderHealthContributor);
}
@Bean
public SolaceBinderHealthContributor solaceBinderHealthContributor(
SolaceSessionHealthProperties solaceSessionHealthProperties) {
if (log.isDebugEnabled()) {
log.debug("Creating Solace Connection Health Indicators Hierarchy");
}
return new SolaceBinderHealthContributor(
new SessionHealthIndicator(solaceSessionHealthProperties),
new BindingsHealthContributor()
);
}
@Bean
public SolaceSessionEventHandler solaceSessionEventHandler(SolaceBinderHealthContributor healthContributor) {
if (log.isDebugEnabled()) {
log.debug("Creating Solace Session Event Handler for monitoring Health");
}
return new SolaceSessionEventHandler(healthContributor.getSolaceSessionHealthIndicator());
}
}