Package org.mockserver.async.publish
Interface MessagePublisher
- All Known Implementing Classes:
KafkaMessagePublisher,MqttMessagePublisher
public interface MessagePublisher
Publishes a message payload to a named channel (topic).
Implementations exist for Kafka (KafkaMessagePublisher) and MQTT (MqttMessagePublisher).
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release any resources held by this publisher (producer connections, etc.).voidPublish the given payload to the specified channel with no key or headers.default voidPublish the given payload with an optional key and headers.default voidpublish(String channel, String payload, PublishOptions options) Publish the given payload with per-message options derived from AsyncAPI bindings.
-
Method Details
-
publish
Publish the given payload to the specified channel with no key or headers.- Parameters:
channel- the channel / topic namepayload- the message payload (typically JSON)
-
publish
Publish the given payload with an optional key and headers. Default implementation delegates topublish(String, String), ignoring key and headers — implementations that support them override this.- Parameters:
channel- the channel / topic namekey- the message key (may be null)payload- the message payload (typically JSON)headers- optional headers (may be null)
-
publish
Publish the given payload with per-message options derived from AsyncAPI bindings. Default implementation delegates topublish(String, String), ignoring the options — implementations that support them override this.- Parameters:
channel- the channel / topic namepayload- the message payload (typically JSON)options- per-message publish options (may be null)
-
close
void close()Release any resources held by this publisher (producer connections, etc.).
-