Module bus.extra

Interface Message


public interface Message
Represents a generic message in a Message Queue (MQ) system. This interface defines the basic structure and operations for a message, including retrieving its topic and content.
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Retrieves the raw content of the message as a byte array.
    default String
    content(Charset charset)
    Retrieves the message content as a string, decoding it using the specified character set.
    Retrieves the topic associated with this message.
  • Method Details

    • topic

      String topic()
      Retrieves the topic associated with this message. The topic is used to categorize messages and for routing in MQ systems.
      Returns:
      The topic of the message as a String.
    • content

      byte[] content()
      Retrieves the raw content of the message as a byte array. This method provides the message payload in its original binary format.
      Returns:
      The message content as a byte[].
    • content

      default String content(Charset charset)
      Retrieves the message content as a string, decoding it using the specified character set. This is a convenience method for converting the byte array content into a readable string.
      Parameters:
      charset - The Charset to use for decoding the message content.
      Returns:
      The message content as a String decoded with the given charset.