Package org.mockserver.async
Class AsyncApiMockOrchestrator
java.lang.Object
org.mockserver.async.AsyncApiMockOrchestrator
Orchestrates publishing of example messages derived from an AsyncAPI spec
to a message broker via a
MessagePublisher.
Supports one-shot publishing (publishAll()) and scheduled
periodic publishing (startPublishing(long) / stop()).
When a message defines a correlationId.location, the orchestrator
generates a unique correlation ID at publish time and injects it at the
specified location (header or payload JSON Pointer).
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncApiMockOrchestrator(AsyncApiSpec spec, MessagePublisher publisher) AsyncApiMockOrchestrator(AsyncApiSpec spec, MessagePublisher publisher, MessageExampleGenerator generator) Constructor for use with a custom generator (used by the control-plane implementation and tests). -
Method Summary
Modifier and TypeMethodDescriptionvoidPublish the generated example message for each message in each channel, threading any AsyncAPI bindings (MQTT qos/retain, Kafka key) and correlation IDs asPublishOptions.voidstartPublishing(long intervalMillis) Start periodic publishing at the given interval.voidstop()Stop periodic publishing.
-
Constructor Details
-
AsyncApiMockOrchestrator
-
AsyncApiMockOrchestrator
public AsyncApiMockOrchestrator(AsyncApiSpec spec, MessagePublisher publisher, MessageExampleGenerator generator) Constructor for use with a custom generator (used by the control-plane implementation and tests).
-
-
Method Details
-
publishAll
public void publishAll()Publish the generated example message for each message in each channel, threading any AsyncAPI bindings (MQTT qos/retain, Kafka key) and correlation IDs asPublishOptions.Multi-message channels (v3 multiple
messages, v2oneOf) result in one publish call per message. Single-message channels behave identically to the previous single-publish behavior. -
startPublishing
public void startPublishing(long intervalMillis) Start periodic publishing at the given interval.- Parameters:
intervalMillis- the interval between publish cycles in milliseconds
-
stop
public void stop()Stop periodic publishing.
-