Record Class RedisMessage

java.lang.Object
java.lang.Record
io.micronaut.configuration.lettuce.pubsub.RedisMessage
Record Components:
body - The raw message body
channel - The resolved channel name
pattern - The subscription pattern if the message was matched by pattern

public record RedisMessage(byte[] body, String channel, @Nullable String pattern) extends Record
The message delivered from Redis Pub/Sub.
Since:
7.0
Author:
Graeme Rocher
  • Constructor Details

    • RedisMessage

      public RedisMessage(byte[] body, String channel, @Nullable String pattern)
      Creates an instance of a RedisMessage record class.
      Parameters:
      body - the value for the body record component
      channel - the value for the channel record component
      pattern - the value for the pattern record component
  • Method Details

    • body

      public byte[] body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • getBody

      public byte[] getBody()
      Returns:
      The raw message body
    • getChannel

      public String getChannel()
      Returns:
      The channel name
    • getPattern

      public Optional<String> getPattern()
      Returns:
      The subscription pattern, if any
    • equals

      public boolean equals(Object object)
      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:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • hashCode

      public 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
    • toString

      public 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
    • channel

      public String channel()
      Returns the value of the channel record component.
      Returns:
      the value of the channel record component
    • pattern

      public @Nullable String pattern()
      Returns the value of the pattern record component.
      Returns:
      the value of the pattern record component