Package org.mockserver.async.publish
Class PublishOptions
java.lang.Object
org.mockserver.async.publish.PublishOptions
Immutable carrier for per-message publish-time options extracted from AsyncAPI bindings.
All fields are nullable; a null value means "use the publisher default".
key— Kafka record key (frommessage.bindings.kafka.key)qos— MQTT QoS level 0, 1, or 2 (fromoperationBindings.mqtt.qos)retain— MQTT retain flag (fromoperationBindings.mqtt.retain)headers— message headers, e.g. for correlation IDs (may be empty)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PublishOptions
Backward-compatible constructor — no headers.- Parameters:
key- Kafka record key (may be null)qos- MQTT QoS level (may be null; must be 0, 1, or 2 when non-null)retain- MQTT retain flag (may be null)- Throws:
IllegalArgumentException- ifqosis non-null and not in {0, 1, 2}
-
PublishOptions
Full constructor with headers.- Parameters:
key- Kafka record key (may be null)qos- MQTT QoS level (may be null; must be 0, 1, or 2 when non-null)retain- MQTT retain flag (may be null)headers- message headers (may be null; defensively copied)- Throws:
IllegalArgumentException- ifqosis non-null and not in {0, 1, 2}
-
-
Method Details
-
none
- Returns:
- a shared instance with all fields null/empty (no bindings)
-
getKey
- Returns:
- the Kafka record key, or null if not specified
-
getQos
- Returns:
- the MQTT QoS level (0, 1, or 2), or null if not specified
-
getRetain
- Returns:
- the MQTT retain flag, or null if not specified
-
getHeaders
- Returns:
- unmodifiable message headers (never null; empty when no headers)
-
isEmpty
public boolean isEmpty()- Returns:
- true if all fields are null/empty (no bindings)
-
toString
-