Skip to content

Commit

Permalink
Merge pull request #2014 from reportportal/hotfix/5.11.2
Browse files Browse the repository at this point in the history
5.11.2
  • Loading branch information
pbortnik committed Jun 28, 2024
2 parents 9f4b2cc + 407a5e9 commit 5bd46eb
Show file tree
Hide file tree
Showing 2 changed files with 47 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,46 @@
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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;

/**
* Health Indicator for rabbitmq.
*
* @author <a href="mailto:pavel_bortnik@epam.com">Pavel Bortnik</a>
*/
@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 5bd46eb

Please sign in to comment.