Skip to main content

Wait for cube feeding

At application start-up, DirectQuery needs to feed the Aggregate providers and the hierarchies by querying the external database. Like for a non-DirectQuery application, the cube will be empty and queries will return empty results until this feeding is done.

Starting the application can be done like this:

application.start();

It is also possible to start the application asynchronously and wait for the feeding to be done:

final CubeFeedingPromise cubeFeedingPromise = application.startAsync();
// Do something else during the cube feeding
cubeFeedingPromise.waitForCompletion();

In Spring it is recommended to do this feeding after the creation of all the beans. This can be done by registering a Spring CommandLineRunner:

@Component
public class FeedCubeCommandLineRunner implements CommandLineRunner {
private final IApplication application;
public FeedCubeCommandLineRunner(final IApplication application) {
this.application = application;
}
@Override
public void run(final String... args) {
this.application.start();
System.out.print("Application feeding completed");
}
}