Package org.mockserver.async.asyncapi
Class AsyncApiMessage
java.lang.Object
org.mockserver.async.asyncapi.AsyncApiMessage
Represents a single message definition within an AsyncAPI channel.
A channel may contain multiple messages (AsyncAPI 3.x channels.<n>.messages
or AsyncAPI 2.x oneOf in the operation message). Each message has its own
payload schema, examples, optional Kafka key binding, and optional correlation ID location.
MQTT qos/retain remain channel-level (operation binding) and are not per-message.
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncApiMessage(String name, com.fasterxml.jackson.databind.JsonNode payloadSchema, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, String kafkaKey) Backward-compatible constructor — no correlation ID.AsyncApiMessage(String name, com.fasterxml.jackson.databind.JsonNode payloadSchema, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, String kafkaKey, String correlationIdLocation) Full constructor with correlation ID location. -
Method Summary
Modifier and TypeMethodDescriptionThe AsyncAPI correlation ID runtime expression (e.g.Kafka message key from message-level bindings, or null if not derivable.getName()The message name, or null for anonymous / unnamed messages.List<com.fasterxml.jackson.databind.JsonNode>Explicit examples found in the spec for this message's payload.com.fasterxml.jackson.databind.JsonNodeThe JSON Schema describing the payload (may be null if not present).
-
Constructor Details
-
AsyncApiMessage
public AsyncApiMessage(String name, com.fasterxml.jackson.databind.JsonNode payloadSchema, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, String kafkaKey) Backward-compatible constructor — no correlation ID.- Parameters:
name- the message name (nullable; e.g. the key undermessages.<name>in v3)payloadSchema- the JSON Schema for the payload (may be null)payloadExamples- explicit payload examples from the spec (never null after construction)kafkaKey- Kafka message key from message-level bindings (may be null)
-
AsyncApiMessage
public AsyncApiMessage(String name, com.fasterxml.jackson.databind.JsonNode payloadSchema, List<com.fasterxml.jackson.databind.JsonNode> payloadExamples, String kafkaKey, String correlationIdLocation) Full constructor with correlation ID location.- Parameters:
name- the message name (nullable; e.g. the key undermessages.<name>in v3)payloadSchema- the JSON Schema for the payload (may be null)payloadExamples- explicit payload examples from the spec (never null after construction)kafkaKey- Kafka message key from message-level bindings (may be null)correlationIdLocation- the runtime expression fromcorrelationId.location(may be null)
-
-
Method Details
-
getName
The message name, or null for anonymous / unnamed messages. -
getPayloadSchema
public com.fasterxml.jackson.databind.JsonNode getPayloadSchema()The JSON Schema describing the payload (may be null if not present). -
getPayloadExamples
Explicit examples found in the spec for this message's payload. -
getKafkaKey
Kafka message key from message-level bindings, or null if not derivable. -
getCorrelationIdLocation
The AsyncAPI correlation ID runtime expression (e.g.$message.header#/correlationIdor$message.payload#/metadata/id), or null if the message does not define a correlation ID.
-