Package com.rabbitmq.client.amqp
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
Modifier and TypeInterfaceDescriptionstatic interface
API to deal with the feedback the broker provides after its processing of a published message.static interface
Feedback context.static enum
Message status.Nested classes/interfaces inherited from interface com.rabbitmq.client.amqp.Resource
Resource.State, Resource.StateListener
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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.void
publish
(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 be 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 be 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:
close
in interfaceAutoCloseable
-