Package org.mockserver.async.asyncapi
Class AsyncApiChannel
java.lang.Object
org.mockserver.async.asyncapi.AsyncApiChannel
Represents a single channel from an AsyncAPI specification,
with its name, zero or more message payload examples, and
optional publish-time bindings (MQTT qos/retain, Kafka key).
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema) Backward-compatible constructor — no bindings.AsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema, Integer mqttQos, Boolean mqttRetain, String kafkaKey) Full constructor with optional binding fields.AsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema, Integer mqttQos, Boolean mqttRetain, String kafkaKey, List<AsyncApiMessage> explicitMessages) Full constructor with optional binding fields and explicit multi-message list.AsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema, Integer mqttQos, Boolean mqttRetain, String kafkaKey, List<AsyncApiMessage> explicitMessages, String correlationIdLocation) Full constructor with optional binding fields, explicit multi-message list, and correlation ID location for single-message channels. -
Method Summary
Modifier and TypeMethodDescriptionKafka message key from message-level bindings, or null if not derivable.Returns all messages for this channel as a uniform list.MQTT QoS level (0, 1, or 2) from operation-level bindings, or null if not specified.MQTT retain flag from operation-level bindings, or null if not specified.getName()List<com.fasterxml.jackson.databind.JsonNode>Explicit examples found in the spec for the channel's message payload.com.fasterxml.jackson.databind.JsonNodeThe JSON Schema describing the payload (may be null if not present).Build aPublishOptionsfrom the parsed bindings on this channel.
-
Constructor Details
-
AsyncApiChannel
public AsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema) Backward-compatible constructor — no bindings. -
AsyncApiChannel
public AsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema, Integer mqttQos, Boolean mqttRetain, String kafkaKey) Full constructor with optional binding fields.- Parameters:
name- the channel / topic namepayloadExamples- explicit payload examples from the specpayloadSchema- the JSON Schema for the payload (may be null)mqttQos- MQTT QoS level from operation bindings (may be null)mqttRetain- MQTT retain flag from operation bindings (may be null)kafkaKey- Kafka message key from message bindings (may be null)
-
AsyncApiChannel
public AsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema, Integer mqttQos, Boolean mqttRetain, String kafkaKey, List<AsyncApiMessage> explicitMessages) Full constructor with optional binding fields and explicit multi-message list.- Parameters:
name- the channel / topic namepayloadExamples- explicit payload examples from the spec (first message's examples for back-compat)payloadSchema- the JSON Schema for the payload (first message's schema for back-compat)mqttQos- MQTT QoS level from operation bindings (may be null)mqttRetain- MQTT retain flag from operation bindings (may be null)kafkaKey- Kafka message key from first message's bindings (may be null)explicitMessages- the list of all messages in this channel (null or empty for single-message channels)
-
AsyncApiChannel
public AsyncApiChannel(String name, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, com.fasterxml.jackson.databind.JsonNode payloadSchema, Integer mqttQos, Boolean mqttRetain, String kafkaKey, List<AsyncApiMessage> explicitMessages, String correlationIdLocation) Full constructor with optional binding fields, explicit multi-message list, and correlation ID location for single-message channels.- Parameters:
name- the channel / topic namepayloadExamples- explicit payload examples from the spec (first message's examples for back-compat)payloadSchema- the JSON Schema for the payload (first message's schema for back-compat)mqttQos- MQTT QoS level from operation bindings (may be null)mqttRetain- MQTT retain flag from operation bindings (may be null)kafkaKey- Kafka message key from first message's bindings (may be null)explicitMessages- the list of all messages in this channel (null or empty for single-message channels)correlationIdLocation- correlation ID runtime expression for single-message channels (may be null)
-
-
Method Details
-
getName
-
getPayloadExamples
Explicit examples found in the spec for the channel's message payload. -
getPayloadSchema
public com.fasterxml.jackson.databind.JsonNode getPayloadSchema()The JSON Schema describing the payload (may be null if not present). -
getMqttQos
MQTT QoS level (0, 1, or 2) from operation-level bindings, or null if not specified. -
getMqttRetain
MQTT retain flag from operation-level bindings, or null if not specified. -
getKafkaKey
Kafka message key from message-level bindings, or null if not derivable. Only populated when a literal value (const, example, examples[0]) is present. -
getMessages
Returns all messages for this channel as a uniform list.If this channel was parsed with multiple explicit messages (v3 multi-message or v2 oneOf), returns that list. Otherwise, synthesizes a single-element list from this channel's existing payload schema, examples, and kafka key fields, providing a uniform per-message view for both single- and multi-message channels.
- Returns:
- an unmodifiable list of at least one
AsyncApiMessage
-
toPublishOptions
Build aPublishOptionsfrom the parsed bindings on this channel.- Returns:
- a PublishOptions carrying the binding values, or
PublishOptions.none()when all are null
-