Quarkus - Hivemq Client

This extension allows usage of the HiveMQ MQTT Client inside a Quarkus App, in JVM and Native mode.

Together with the "SmallRye Reactive Messaging MQTT" extension allows usage of a new connector type smallrye-mqtt-hivemq that will use HiveMQ MQTT Client instead of Vertx MQTT client.

This adds some benefits to the original SmallRye MQTT:

  • Battle tested MQTT Client outside of Vertx landscape

  • Management of external CA file for secure connections with self-signed certificates

  • Backpressure support integrated with MQTT QOS

  • Automatic and configurable reconnection handling and message redelivery

  • Real Health Check againsts a configurable topic (defaults to the standard MQTT $SYS/broker/uptime) integrated in Quarkus HealthReport

  • Many others you can read in official documentation here.

Installation

If you want to use this extension, you need to add the io.quarkiverse.hivemqclient:quarkus-hivemq-client extension first. In your pom.xml file, add:

<dependency>
    <groupId>io.quarkiverse.hivemqclient</groupId>
    <artifactId>quarkus-hivemq-client</artifactId>
</dependency>

If you also want to use SmallRye Reactive Messaging integration in your pom.xml file, add:

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-reactive-messaging-mqtt</artifactId>
    </dependency>

Extension Configuration Reference

These are the configurations added to the original SmallRye’s MQTT Connector once this is specified in application.properties:

    <dependency>
        <groupId>io.quarkiverse.hivemqclient</groupId>
        <artifactId>quarkus-hivemq-client</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-reactive-messaging-mqtt</artifactId>
    </dependency>

Configuration property

Type

Default

Direction

reconnect-attempts

Set the max reconnect attempts.

int

5

INCOMING_AND_OUTGOING

reconnect-interval-seconds

Set the reconnect interval in seconds.

int

1

INCOMING_AND_OUTGOING

ca-cart-file

File containing the self-signed CA for SSL connection.

string

INCOMING_AND_OUTGOING

check-topic-enabled

Enable check for liveness/readiness.

boolean

false

INCOMING_AND_OUTGOING

check-topic-name

Topic Used to check liveness/readiness.

string

$SYS/broker/uptime

INCOMING_AND_OUTGOING

readiness-timeout

Timeout to declare the MQTT Client not ready (in ms).

int

20000

INCOMING_AND_OUTGOING

liveness-timeout

Timeout to declare the MQTT Client not alive.

int

120000

INCOMING_AND_OUTGOING

:leveloffset!: