Class IncomingMessage<T>

java.lang.Object
dev.ua.theroer.magicutils.messaging.IncomingMessage<T>
Type Parameters:
T - payload type

public final class IncomingMessage<T> extends Object
A received message as seen by a typed subscriber.

Lazily decodes the payload into the subscriber's requested type on first access to payload(), so a handler that only inspects the source never pays the deserialization cost.

  • Method Details

    • channel

      public String channel()
      Returns the channel this message arrived on.
      Returns:
      channel name
    • source

      public MessageSource source()
      Returns the member that sent this message.
      Returns:
      originating source
    • target

      public Target target()
      Returns the addressing hint the sender used.
      Returns:
      target
    • envelope

      public MessageEnvelope envelope()
      Returns the underlying envelope for advanced use.
      Returns:
      envelope
    • payload

      public T payload()
      Returns the decoded payload, deserializing on first access.
      Returns:
      decoded payload (may be null for empty payloads)