export messages published to a broker using prometheus

336 Views Asked by At

I have this components that publishes messages to a broker I want to export the same message to prometheus

public class ModuleAMessagePublisher {

    @Inject
    @InternalBroker
    private MessagePublisher messagePublisher;

    public void publish(String topic, final String message) {
        log.info("<><><><><><><><><> (MQ) PUBLISH MODULEA MESSAGE: <><><><><><<>\n", message);
        messagePublisher.publish(topic, message);
// code for prometheus to be added here

    }

}

I'm so new to using prometheus and I'm not sure if it's possible to be done or how can it be done

1

There are 1 best solutions below

0
On

You can use the hivemq extention provided to host all the metrics on your hivemq server as described here -

https://www.hivemq.com/extension/prometheus-extension/

This will enable a /metrics endpoint on hivemq server which can be consumed by your prometheus server.