> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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:

```java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
application.start();
```

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

```java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
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:

```java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
@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");
  }
}
```
