Skip to content

Commit

Permalink
EPMRPP-92293 || Remove rabbit version from health check
Browse files Browse the repository at this point in the history
  • Loading branch information
pbortnik committed Jun 28, 2024
1 parent 9f4b2cc commit 47c854e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 47c854e

Please sign in to comment.