Class CommandMessage


  • public final class CommandMessage
    extends java.lang.Object
    A command message that uses OP_MSG or OP_QUERY to send the command.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void encode​(BsonOutput bsonOutput, SessionContext sessionContext)
      Encoded the message to the given output.
      static int getCurrentGlobalId()
      Gets the next available unique message identifier.
      com.mongodb.internal.connection.RequestMessage.EncodingMetadata getEncodingMetadata()
      Gets the encoding metadata from the last attempt to encode this message.
      int getId()
      Gets the message id.
      com.mongodb.internal.connection.OpCode getOpCode()
      Gets the op code of the message.
      com.mongodb.internal.connection.MessageSettings getSettings()
      Gets the message settings.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getCurrentGlobalId

        public static int getCurrentGlobalId()
        Gets the next available unique message identifier.
        Returns:
        the message identifier
      • getId

        public int getId()
        Gets the message id.
        Returns:
        the message id
      • getOpCode

        public com.mongodb.internal.connection.OpCode getOpCode()
        Gets the op code of the message.
        Returns:
        the op code
      • getSettings

        public com.mongodb.internal.connection.MessageSettings getSettings()
        Gets the message settings.
        Returns:
        the message settings
      • encode

        public void encode​(BsonOutput bsonOutput,
                           SessionContext sessionContext)
        Encoded the message to the given output.
        Parameters:
        bsonOutput - the output
        sessionContext - the session context
      • getEncodingMetadata

        public com.mongodb.internal.connection.RequestMessage.EncodingMetadata getEncodingMetadata()
        Gets the encoding metadata from the last attempt to encode this message.
        Returns:
        Get metadata from the last attempt to encode this message. Returns null if there has not yet been an attempt.