Record Class MessageBatch

java.lang.Object
java.lang.Record
org.springframework.amqp.rabbit.batch.MessageBatch
Record Components:
exchange - the exchange for batch of messages
routingKey - the routing key for batch
message - the message with a batch

public record MessageBatch(@Nullable String exchange, @Nullable String routingKey, Message message) extends Record
An object encapsulating a Message containing the batch of messages, the exchange, and routing key.
Since:
1.4.1
Author:
Gary Russell, Artem Bilan
  • Constructor Details

    • MessageBatch

      public MessageBatch(@Nullable String exchange, @Nullable String routingKey, Message message)
      Creates an instance of a MessageBatch record class.
      Parameters:
      exchange - the value for the exchange record component
      routingKey - the value for the routingKey record component
      message - the value for the message record component
  • Method Details

    • getExchange

      @Deprecated(forRemoval=true, since="4.0") public @Nullable String getExchange()
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor or exchange().
      Returns:
      the exchange
    • getRoutingKey

      @Deprecated(forRemoval=true, since="4.0") public @Nullable String getRoutingKey()
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor or routingKey().
      Returns:
      the routingKey
    • getMessage

      @Deprecated(forRemoval=true, since="4.0") public Message getMessage()
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor or message() ()}.
      Returns:
      the message
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • exchange

      public @Nullable String exchange()
      Returns the value of the exchange record component.
      Returns:
      the value of the exchange record component
    • routingKey

      public @Nullable String routingKey()
      Returns the value of the routingKey record component.
      Returns:
      the value of the routingKey record component
    • message

      public Message message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component