Last active
April 10, 2018 12:14
-
-
Save acogoluegnes/efb087b75d9d2a710d0f9076f10e6b23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MeterRegistry jmxRegistry = new JmxMeterRegistry(JmxConfig.DEFAULT, Clock.SYSTEM); | |
ConnectionFactory connectionFactory = new ConnectionFactory(); | |
MicrometerMetricsCollector metricsCollector = new MicrometerMetricsCollector( | |
jmxRegistry, "rabbitmq.client" | |
); | |
connectionFactory.setMetricsCollector(metricsCollector); | |
Connection connection = connectionFactory.newConnection(); | |
Channel channel = connection.createChannel(); | |
String queue = channel.queueDeclare().getQueue(); | |
channel.basicConsume(queue, true, (ctag, msg) -> { }, (ctag) -> { }); | |
executor.submit(() -> { | |
Random random = new Random(); | |
while (true) { | |
Thread.sleep(random.nextInt(100)); | |
channel.basicPublish("", queue, null, "".getBytes()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment