DirectQuery REST service
DirectQuery REST service
The DirectQuery REST service allows for incremental refreshing of the remote database as well as validating the Schema while the application is running.
The REST service is available at: host:port/frtb-starter/directquery/
The REST service contains the following components:
Security Configuration
The security configuration is handled by the DQRestServiceSecurityConfig
bean defined in the SecurityConfig
. The default security config limits the use of
this service to only ADMIN
use.
Application Refresh
The application can be refreshed at any point in time to ensure the DirectQuery aggregates are in sync with the remote database. For more information about this process, see the Atoti Server’s documentation for Application Refresh.
When the application starts, we run aggregation queries and store the results in-memory. This allows us to execute queries without needing to run queries on the remote database.
Out-of-the-box, the aggregates are defined to just exclude the Trade level. This is defined in the DirectQueryAggregateProviderConfig
class which means trade-level queries will have to be executed on the remote database.
If new data is added to the remote database, the application will not reflect these new values. To get the application in sync with the remote database, a refresh operation must be performed.
/refresh
Endpoint
URL: host:port/frtb-starter/directquery/refresh
Request Type: POST
Body: none
JSON Response
The response will indicate the total time in Milliseconds the refresh operation took to complete.
Example response:
{
"refreshTimeInMilliseconds": 12345
}
Schema Validation
A schema validation check can be performed at any point in time and does not affect the application.
The validation simply runs some checks against the remote database to ensure tables are readable and that there are no duplicate keys in any of the database tables.
If the remote database schema is bad / invalid, this can result in significant performance issues. A schema with duplicate keys can result in longer than normal aggregation / application refresh times.
/validateSchema
Endpoint
URL: host:port/frtb-starter/directquery/validateSchema
Request Type: GET
Response
The response will indicate if there were any errors, what they were, the SQL to reproduce the failed check, and how long the validation check took.
Example response:
{
"errors": [],
"totalTimeInMilliseconds": 12345,
"valid": true
}