Package com.mongodb.event
Class CommandEvent
java.lang.Object
com.mongodb.event.CommandEvent
- Direct Known Subclasses:
CommandFailedEvent
,CommandStartedEvent
,CommandSucceededEvent
An event representing a MongoDB database command.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionCommandEvent
(int requestId, ConnectionDescription connectionDescription, String commandName) Construct an instance.CommandEvent
(RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String commandName) Deprecated.CommandEvent
(RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String commandName) CommandEvent
(RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the name of the command.Gets the description of the connection to which the operation will be sent.Gets the database on which the operation will be executed.long
Gets the operation identifierGets the request context associated with this event.int
Gets the request identifier
-
Constructor Details
-
CommandEvent
public CommandEvent(@Nullable RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName) Construct an instance.- Parameters:
requestContext
- the request contextoperationId
- the operation idrequestId
- the request idconnectionDescription
- the connection descriptiondatabaseName
- the database namecommandName
- the command name- Since:
- 4.11
-
CommandEvent
@Deprecated public CommandEvent(@Nullable RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String commandName) Construct an instance.- Parameters:
requestContext
- the request contextoperationId
- the operation idrequestId
- the request idconnectionDescription
- the connection descriptioncommandName
- 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 contextrequestId
- the request idconnectionDescription
- the connection descriptioncommandName
- the command name- Since:
- 4.4
-
CommandEvent
Construct an instance.- Parameters:
requestId
- the request idconnectionDescription
- the connection descriptioncommandName
- 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
Gets the description of the connection to which the operation will be sent.- Returns:
- the connection description
-
getCommandName
Gets the name of the command.- Returns:
- the command name
-
getDatabaseName
Gets the database on which the operation will be executed.- Returns:
- the database name
- Since:
- 4.11
-
getRequestContext
Gets the request context associated with this event.- Returns:
- the request context
- Since:
- 4.4
-
CommandEvent(RequestContext, long, int, ConnectionDescription, String, String)