Interface Publisher

All Superinterfaces:
AutoCloseable, Resource

public interface Publisher extends 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 Classes
    Modifier and Type
    Interface
    Description
    static 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 Type
    Method
    Description
    void
    Close the publisher and release its resources.
    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

      Message message(byte[] body)
      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

      void publish(Message message, Publisher.Callback callback)
      Publish a message.
      Parameters:
      message - message to publish
      callback - asynchronous callback for broker message processing feedback
    • close

      void close()
      Close the publisher and release its resources.
      Specified by:
      close in interface AutoCloseable