diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8fe675b7ea..a85603d5ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ on: env: GH_USER_NAME: github.actor - RELEASE_VERSION: 5.11.1 + RELEASE_VERSION: 5.11.2 REPOSITORY_URL: 'https://maven.pkg.github.com/' jobs: diff --git a/src/main/java/com/epam/ta/reportportal/health/RabbitHealthIndicator.java b/src/main/java/com/epam/ta/reportportal/health/RabbitHealthIndicator.java new file mode 100644 index 0000000000..55ab3ccfd2 --- /dev/null +++ b/src/main/java/com/epam/ta/reportportal/health/RabbitHealthIndicator.java @@ -0,0 +1,26 @@ +package com.epam.ta.reportportal.health; + +import com.rabbitmq.client.Channel; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.boot.actuate.health.AbstractHealthIndicator; +import org.springframework.boot.actuate.health.Health; +import org.springframework.stereotype.Component; +import org.springframework.util.Assert; + +@Component +public class RabbitHealthIndicator extends AbstractHealthIndicator { + + private final RabbitTemplate rabbitTemplate; + + public RabbitHealthIndicator(RabbitTemplate rabbitTemplate) { + super("Rabbit health check failed"); + Assert.notNull(rabbitTemplate, "RabbitTemplate must not be null"); + this.rabbitTemplate = rabbitTemplate; + } + + @Override + protected void doHealthCheck(Health.Builder builder) { + rabbitTemplate.execute(Channel::getConnection); + builder.up(); + } +}