Class Mqtt5MessageSubscriber

java.lang.Object
org.mockserver.async.subscribe.Mqtt5MessageSubscriber
All Implemented Interfaces:
MessageSubscriber

public class Mqtt5MessageSubscriber extends Object implements MessageSubscriber
A MessageSubscriber that uses an MQTT v5 MqttClient to subscribe to topics and record received messages — the v5 counterpart of MqttMessageSubscriber.

MQTT 5 user properties on incoming messages are recorded as the RecordedMessage headers (MQTT 3 has no equivalent). Recorded messages are stored in a bounded BoundedMessageStore per channel to prevent unbounded memory growth.

  • Constructor Details

    • Mqtt5MessageSubscriber

      public Mqtt5MessageSubscriber(String brokerUrl, String clientId)
      Create a v5 subscriber connected to the given broker with no security.
    • Mqtt5MessageSubscriber

      public Mqtt5MessageSubscriber(String brokerUrl, String clientId, int qos)
      Create a v5 subscriber with a specific QoS and no security.
    • Mqtt5MessageSubscriber

      public Mqtt5MessageSubscriber(String brokerUrl, String clientId, int qos, int maxRecordedMessages, MqttSecurity security)
      Create a v5 subscriber with optional security configuration.
      Parameters:
      brokerUrl - the MQTT broker URL
      clientId - the client identifier
      qos - the MQTT QoS level (0, 1, or 2)
      maxRecordedMessages - maximum recorded messages per channel
      security - security configuration (may be null for plaintext)
  • Method Details