Interface Message

  • All Superinterfaces:
    java.util.Map<java.lang.String,java.lang.Object>
    All Known Subinterfaces:
    Message.Mutable, ServerMessage, ServerMessage.Mutable
    All Known Implementing Classes:
    HashMapMessage, ServerMessageImpl

    public interface Message
    extends java.util.Map<java.lang.String,java.lang.Object>

    The Bayeux protocol exchange information by means of messages.

    This interface represents the API of a Bayeux message, and consists mainly of convenience methods to access the known fields of the message map.

    This interface comes in both an immutable and mutable versions. Mutability may be deeply enforced by an implementation, so that it is not correct to cast a passed Message, to a Message.Mutable, even if the implementation allows this.

    • Method Detail

      • getAdvice

        java.util.Map<java.lang.String,java.lang.Object> getAdvice()
        Convenience method to retrieve the ADVICE_FIELD
        Returns:
        the advice of the message
      • getChannel

        java.lang.String getChannel()
        Convenience method to retrieve the CHANNEL_FIELD. Bayeux message always have a non null channel.
        Returns:
        the channel of the message
      • getChannelId

        ChannelId getChannelId()
        Convenience method to retrieve the CHANNEL_FIELD. Bayeux message always have a non null channel.
        Returns:
        the channel of the message
      • getClientId

        java.lang.String getClientId()
        Convenience method to retrieve the CLIENT_ID_FIELD
        Returns:
        the client id of the message
      • getData

        java.lang.Object getData()
        Convenience method to retrieve the DATA_FIELD
        Returns:
        the data of the message
        See Also:
        getDataAsMap()
      • isMeta

        boolean isMeta()
        A messages that has a meta channel is dubbed a "meta message".
        Returns:
        whether the channel's message is a meta channel
      • isPublishReply

        boolean isPublishReply()
        Publish message replies contain the "successful" field
        Returns:
        whether this message is a publish reply (as opposed to a published message)
      • isSuccessful

        boolean isSuccessful()
        Convenience method to retrieve the SUCCESSFUL_FIELD
        Returns:
        whether the message is successful
      • getDataAsMap

        java.util.Map<java.lang.String,java.lang.Object> getDataAsMap()
        Returns:
        the data of the message as a map
        See Also:
        getData()
      • getExt

        java.util.Map<java.lang.String,java.lang.Object> getExt()
        Convenience method to retrieve the EXT_FIELD
        Returns:
        the ext of the message
      • getId

        java.lang.String getId()
        Convenience method to retrieve the ID_FIELD
        Returns:
        the id of the message
      • getJSON

        java.lang.String getJSON()
        Returns:
        this message as a JSON string