Interface Publisher
- All Superinterfaces:
AutoCloseable, Resource
API to send messages.
Instances are created and configured with a PublisherBuilder.
Implementations must be thread-safe.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAPI to deal with the feedback the broker provides after its processing of a published message.static interfaceFeedback context.static enumMessage status.Nested classes/interfaces inherited from interface Resource
Resource.State, Resource.StateListener -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the publisher and release its resources.message()Create a message meant to be published by the publisher instance.message(byte[] body) Create a message meant to be published by the publisher instance.voidpublish(Message message, Publisher.Callback callback) Publish a message.
-
Method Details
-
message
Message message()Create a message meant to be published by the publisher instance.Once published with the
publish(Message, Callback)the message instance should not be modified or even reused.- Returns:
- a message
-
message
Create a message meant to be published by the publisher instance.Once published with the
publish(Message, Callback)the message instance should not be modified or even reused.- Parameters:
body- message body- Returns:
- a message with the provided body
-
publish
Publish a message.- Parameters:
message- message to publishcallback- asynchronous callback for broker message processing feedback
-
close
void close()Close the publisher and release its resources.- Specified by:
closein interfaceAutoCloseable
-