Class PublicationMessageFlyweight

java.lang.Object
io.aeron.command.CorrelatedMessageFlyweight
io.aeron.command.PublicationMessageFlyweight

public class PublicationMessageFlyweight extends CorrelatedMessageFlyweight
Control message for adding or removing a publication
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                          Client ID                            |
  |                                                               |
  +---------------------------------------------------------------+
  |                       Correlation ID                          |
  |                                                               |
  +---------------------------------------------------------------+
  |                          Stream ID                            |
  +---------------------------------------------------------------+
  |                       Channel Length                          |
  +---------------------------------------------------------------+
  |                       Channel (ASCII)                        ...
 ...                                                              |
  +---------------------------------------------------------------+
 
  • Constructor Details

    • PublicationMessageFlyweight

      public PublicationMessageFlyweight()
  • Method Details

    • wrap

      public PublicationMessageFlyweight wrap(MutableDirectBuffer buffer, int offset)
      Wrap the buffer at a given offset for updates.
      Overrides:
      wrap in class CorrelatedMessageFlyweight
      Parameters:
      buffer - to wrap.
      offset - at which the message begins.
      Returns:
      this for a fluent API.
    • streamId

      public int streamId()
      Get the stream id field.
      Returns:
      stream id field.
    • streamId

      public PublicationMessageFlyweight streamId(int streamId)
      Set the stream id field.
      Parameters:
      streamId - field value.
      Returns:
      this for a fluent API.
    • channel

      public String channel()
      Get the channel field in ASCII.
      Returns:
      channel field.
    • appendChannel

      public void appendChannel(Appendable appendable)
      Append the channel value to an Appendable.
      Parameters:
      appendable - to append channel to.
    • channel

      public PublicationMessageFlyweight channel(String channel)
      Set the channel field in ASCII.
      Parameters:
      channel - field value.
      Returns:
      this for a fluent API.
    • length

      public int length()
      Get the length of the current message.

      NB: must be called after the data is written in order to be accurate.

      Returns:
      the length of the current message.
    • validateLength

      public void validateLength(int msgTypeId, int length)
      Validate buffer length is long enough for message.
      Overrides:
      validateLength in class CorrelatedMessageFlyweight
      Parameters:
      msgTypeId - type of message.
      length - of message in bytes to validate.
    • computeLength

      public static int computeLength(int channelLength)
      Compute the length of the command message for a given channel length.
      Parameters:
      channelLength - to be appended to the header.
      Returns:
      the length of the command message for a given channel length.