Git Product home page Git Product logo

spring-rabbitmq-actuator's Introduction

spring-rabbitmq-actuator

Maven Central Codacy Badge Coverage Status Build Status

SpringBoot RabbitMQ Actuator (Queue Metrics & Health-Checks)

Maven

<dependency>
	<groupId>com.itelg.spring</groupId>
	<artifactId>spring-rabbitmq-actuator</artifactId>
	<version>0.5.0-RELEASE</version>
</dependency>

Precondition (Example)

You have to add the declaring RabbitAdmin to each queue. The specific RabbitAdmin is required to fetch the queue-information.

@Bean
public Queue exampleQueue()
{
	Queue queue = new Queue("com.itelg.spring.rabbitmq.test");
	queue.setAdminsThatShouldDeclare(rabbitAdmin());
	return queue;
}

Health-Checks

Example

@Bean
public HealthIndicator rabbitQueueCheckHealthIndicator()
{
	RabbitQueueCheckHealthIndicator healthIndicator = new RabbitQueueCheckHealthIndicator();
	healthIndicator.addQueueCheck(exampleQueue1, 10000, 1);
	healthIndicator.addQueueCheck(exampleQueue2, 50000, 3);
	return healthIndicator;
}

Response (health.json)

{
	"status" : "DOWN",
	"rabbitQueueCheck" : 
	{
		"status" : "DOWN",
		"com.examle.exampleQueue1" : 
		{
			"status" : "UP",
			"currentMessageCount" : 214,
			"maxMessageCount" : 10000,
			"currentConsumerCount" : 5,
			"minConsumerCount" : 1
		},
		"com.example.exampleQueue2" : 
		{
			"status" : "DOWN",
			"currentMessageCount" : 67377,
			"maxMessageCount" : 50000,
			"currentConsumerCount" : 0,
			"minConsumerCount" : 3
		}
	}
}

Metrics

Example (Autowires all queue-beans)

@EnableRabbitMetrics
@Configuration
public class RabbitMetricsConfiguration
{
}

Response (metrics.json)

{
  "mem" : 626258,
  "mem.free" : 460251,
  "processors" : 16,
  "instance.uptime" : 17148451,
...
  "rabbit.queue.com_examle_exampleQueue1.currentMessageCount" : 214,
  "rabbit.queue.com_examle_exampleQueue1.currentConsumerCount" : 5,
  "rabbit.queue.com_examle_exampleQueue2.currentMessageCount" : 67377,
  "rabbit.queue.com_examle_exampleQueue2.currentConsumerCount" : 0,
...
}

spring-rabbitmq-actuator's People

Contributors

julian-eggers avatar

Watchers

Juan Carlos rivera avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.