Query API
Query API
The conta-command-query-api and conta-command-query-mn modules provide a typed interface for searching the command log from application code.
CommandLogQueryService
public interface CommandLogQueryService {
Optional<CommandLog> findOne(String tenantId, UUID cmdUuid);
Slice<CommandLog> find(@NonNull String tenantId,
@Nullable Instant since,
@NonNull Pageable page);
Slice<CommandLog> query(@NonNull CommandLogQueryParams queryParams,
@NonNull Pageable page);
}
findOne-
Look up a single command by tenant and UUID.
find-
List commands for a tenant, optionally filtered from a point in time. Paginated.
query-
Full query with multiple filters. Paginated.
CommandLogQueryParams
All fields are optional — combine them to narrow down results:
| Field | Type | Description |
|---|---|---|
tenantId |
String |
Filter by tenant. |
importanceThreshold |
CommandImportance |
Minimum importance level (e.g., |
commandTypes |
List<String> |
Filter by command class names. |
commandStates |
List<CommandState> |
Filter by outcome (Successful, Failed, etc.). |
httpMethods |
List<SearchableHttpMethod> |
Filter by HTTP method (GET, POST, etc.). |
since |
Instant |
Commands after this timestamp. |
before |
Instant |
Commands before this timestamp. |
commandAttributes |
Map<String, String> |
Filter by custom attribute key-value pairs. |
Searchable enums
The SearchableCommandValue and SearchableCommandAttribute interfaces let you define application-specific enums that map user-friendly query values to actual command class names or attribute keys.
This keeps your API surface clean — callers query by orderCreated instead of com.example.order.CreateOrderCommand.
For interactive querying
The query API is for application code — building UIs, activity feeds, and dashboards. For ad-hoc database queries, see Example Queries and the SQL helper functions.