Class CommandEvent

java.lang.Object
com.mongodb.event.CommandEvent
Direct Known Subclasses:
CommandFailedEvent, CommandStartedEvent, CommandSucceededEvent

public abstract class CommandEvent extends Object
An event representing a MongoDB database command.
Since:
3.1
  • Constructor Details

    • CommandEvent

      public CommandEvent(@Nullable RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String commandName)
      Construct an instance.
      Parameters:
      requestContext - the request context
      operationId - the operation id
      requestId - the request id
      connectionDescription - the connection description
      commandName - the command name
      Since:
      4.10
    • CommandEvent

      @Deprecated public CommandEvent(@Nullable RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String commandName)
      Construct an instance.
      Parameters:
      requestContext - the request context
      requestId - the request id
      connectionDescription - the connection description
      commandName - the command name
      Since:
      4.4
    • CommandEvent

      public CommandEvent(int requestId, ConnectionDescription connectionDescription, String commandName)
      Construct an instance.
      Parameters:
      requestId - the request id
      connectionDescription - the connection description
      commandName - the command name
  • Method Details

    • getOperationId

      public long getOperationId()
      Gets the operation identifier
      Returns:
      the operation identifier
      Since:
      4.10
    • getRequestId

      public int getRequestId()
      Gets the request identifier
      Returns:
      the request identifier
    • getConnectionDescription

      public ConnectionDescription getConnectionDescription()
      Gets the description of the connection to which the operation will be sent.
      Returns:
      the connection description
    • getCommandName

      public String getCommandName()
      Gets the name of the command.
      Returns:
      the command name
    • getRequestContext

      @Nullable public RequestContext getRequestContext()
      Gets the request context associated with this event.
      Returns:
      the request context
      Since:
      4.4