@@ -31,6 +31,8 @@ public abstract class CommandEvent {
31
31
private final int requestId ;
32
32
private final ConnectionDescription connectionDescription ;
33
33
private final String commandName ;
34
+ private final String databaseName ;
35
+
34
36
private final long operationId ;
35
37
36
38
/**
@@ -41,30 +43,49 @@ public abstract class CommandEvent {
41
43
* @param requestId the request id
42
44
* @param connectionDescription the connection description
43
45
* @param commandName the command name
44
- * @since 4.10
46
+ * @param databaseName the database name
47
+ * @since 4.11
45
48
*/
46
49
public CommandEvent (@ Nullable final RequestContext requestContext , final long operationId , final int requestId ,
47
- final ConnectionDescription connectionDescription , final String commandName ) {
50
+ final ConnectionDescription connectionDescription , final String commandName , final String databaseName ) {
48
51
this .requestContext = requestContext ;
49
52
this .requestId = requestId ;
50
53
this .connectionDescription = connectionDescription ;
51
54
this .commandName = commandName ;
55
+ this .databaseName = databaseName ;
52
56
this .operationId = operationId ;
53
57
}
54
58
59
+ /**
60
+ * Construct an instance.
61
+ *
62
+ * @param requestContext the request context
63
+ * @param operationId the operation id
64
+ * @param requestId the request id
65
+ * @param connectionDescription the connection description
66
+ * @param commandName the command name
67
+ * @since 4.10
68
+ * @deprecated Prefer {@link CommandEvent#CommandEvent(RequestContext, long, int, ConnectionDescription, String, String)}
69
+ */
70
+ @ Deprecated
71
+ public CommandEvent (@ Nullable final RequestContext requestContext , final long operationId , final int requestId ,
72
+ final ConnectionDescription connectionDescription , final String commandName ) {
73
+ this (requestContext , -1 , requestId , connectionDescription , commandName , "" );
74
+ }
75
+
55
76
/**
56
77
* Construct an instance.
57
78
* @param requestContext the request context
58
79
* @param requestId the request id
59
80
* @param connectionDescription the connection description
60
81
* @param commandName the command name
61
82
* @since 4.4
62
- * @deprecated Prefer {@link CommandEvent#CommandEvent(RequestContext, long, int, ConnectionDescription, String)}
83
+ * @deprecated Prefer {@link CommandEvent#CommandEvent(RequestContext, long, int, ConnectionDescription, String, String )}
63
84
*/
64
85
@ Deprecated
65
86
public CommandEvent (@ Nullable final RequestContext requestContext , final int requestId ,
66
87
final ConnectionDescription connectionDescription , final String commandName ) {
67
- this (requestContext , -1 , requestId , connectionDescription , commandName );
88
+ this (requestContext , -1 , requestId , connectionDescription , commandName , "" );
68
89
}
69
90
70
91
/**
@@ -114,6 +135,16 @@ public String getCommandName() {
114
135
return commandName ;
115
136
}
116
137
138
+ /**
139
+ * Gets the database on which the operation will be executed.
140
+ *
141
+ * @return the database name
142
+ * @since 4.11
143
+ */
144
+ public String getDatabaseName () {
145
+ return databaseName ;
146
+ }
147
+
117
148
/**
118
149
* Gets the request context associated with this event.
119
150
*
0 commit comments