Interface Producer
- All Superinterfaces:
AutoCloseable
API to send messages to a RabbitMQ Stream.
Instances are created and configured with a ProducerBuilder.
Implementations are expected to be thread-safe, RabbitMQ Streams' are.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the producer.longGet the last publishing ID for a named producer.Return aMessageBuilderto create aMessage.voidsend(Message message, ConfirmationHandler confirmationHandler) Publish a message.
-
Method Details
-
messageBuilder
MessageBuilder messageBuilder()Return aMessageBuilderto create aMessage.A
MessageBuilderinstance is meant to create onlyMessageinstance.- Returns:
- a single-usage
MessageBuilder - See Also:
-
getLastPublishingId
long getLastPublishingId()Get the last publishing ID for a named producer.The value can be mapped to a business index to restart publishing where a previous incarnation of the producer left off.
- Returns:
- the last publishing ID for this named producer
-
send
Publish a message.When this method throws, the message is not sent, the confirmation handler is not called, and the message does not count against the maximum number of unconfirmed messages.
- Parameters:
message- the messageconfirmationHandler- the callback when the message is confirmed or failed- Throws:
IllegalArgumentException- if the message does not fit in a frame (the negotiated maximum frame size, seeEnvironmentBuilder.requestedMaxFrameSize(int))- See Also:
-
close
-