Skip to main content
This guide walks through importing a source module, configuring a source and topic, and submitting a first load request.
Legacy extension - limited maintenance only.This extension is no longer actively developed. It will receive critical bug fixes only and may be removed in a future major or minor release.New projects should not depend on it.Alternatives:
  • Use the Sources API
  • Build customized REST endpoints around the sources
  • Request a supported alternative through the customer portal
After sources are declared through the DLC, they can be accessed via the DLC REST API.

Supported sources

The DLC supports loading data from multiple sources into an Atoti datastore.
SourceWhere data is loaded from
Local CSVCSV files stored locally.
JDBCVia JDBC API.
TupleGenerated by Java code.
AWS CSVCSV files stored on Amazon S3.
Azure CSVCSV files stored on Azure Blob Storage.
GCP CSVCSV files stored on Google Cloud Storage.
Local AvroAvro files stored locally.
Local ParquetParquet files stored locally.
KafkaA Kafka messaging producer.

Imports

Import the module(s) for the data source. Spring Auto Configuration will then load the required configuration classes. If Spring Auto Configuration is not in use, the configuration classes can be loaded manually.
Module dependency
<dependency>
    <groupId>com.activeviam.io</groupId>
    <artifactId>data-load-controller</artifactId>
    <version>${atoti.server.version}</version>
</dependency>
Spring Auto Configuration classes
DataLoadControllerConfig.class,
LocalCsvConnectorConfig.class

Configuration

The DLC can be configured in Java via Spring Beans. Most things can also be configured via Spring Boot’s Externalized Configuration, for example, using application.yml.

Sources

The first thing to configure is a source, which is a location where data is loaded from. This is also the minimum configuration for loading data into an Atoti Server.
YAML configuration
dlc:
  csv:
    local:
      sources:
        localCsvSource:
          root-base-dir: 'data'
          topics-to-include:
            - topic1
            - topic2
Java configuration
@Bean
LocalCsvSourceDescription source() {
    return LocalCsvSourceDescription.builder("localCsvSource", "data").build();
}
For more information on configuration, see Local CSV Source.

Topics

A topic describes a specific collection of columnar data for loading into an Atoti Server. A topic includes the source format as well as a target for the data to be loaded into, some of which is implicit in a minimal configuration. The DLC can also create implicit loading topics for CSV. See CSV topic.
The following configuration examples configure a topic called “Trades”, which loads files that match the file pattern trades*.csv.This configuration does not specify a target for the data or the data format.
If the topic is not named the same as the store, the target must be explicitly specified in the channel of the topic.
  • The target is implicitly the Atoti table named “Trades”.
  • The format (column order and how input fields are parsed) implicitly comes from the columns and types of the targeted Atoti table, in this case “Trades”.
YAML configuration
dlc:
  csv:
    topics:
      Trades:
        file-pattern: 'glob:trades*.csv'
Java configuration
@Bean
public CsvTopicDescription trades() {
    return CsvTopicDescription.builder("Trades", "glob:trades*.csv")
            .build();
}
For more information on configuration, see CSV Topic.

Aliases

Within the DLC, aliases can be defined for topics. This allows multiple topics to be grouped for loading and unloading. YAML configuration
dlc:
  aliases:
    alias:
      - trades
      - sensitivities
Java configuration
@Bean
AliasesDescription aliases() {
    var aliases = new AliasesDescription();
    aliases.put("alias", Set.of("Trades", "sensitivities"));
    return aliases;
}
For more information on configuration, see Aliases.

DLC requests

Loading and unloading is initiated by sending requests to the DLC. The DLC provides APIs for Java requests as well as REST requests. Requests contain an operation and a list of topics or aliases.

Operations

The DLC comes with the following operations:
  • LOAD - Loads data into the datastore.
  • UNLOAD - Unloads data from the datastore.
  • START_LISTEN - Starts listening for files, triggering a load operation when a file is detected.
  • LISTEN_STATUS - Gets the status of a listener.
  • STOP_LISTEN - Stops listening for files.
For more information, see DLC Operations.

Request

A request contains an operation and a list of topics or aliases. Additionally, a scope can be provided to a DLC request. The request can also override existing topic configurations. Read More

Example: Load a topic

Given the above Local Csv configuration of the localCsvSource source and trades topic, the following request will load the data/trades1.csv and data/trades2.csvfiles into the trades store.
POST https://<hostname>:<port>/<app-context>/connectors/rest/dlc/v2
Content-Type: application/json

{
  "operation": "LOAD",
  "topics": [ "Trades" ]
}

Example: Start listening on a topic

Given the above Local Csv configuration of the localCsvSource source and trades topic, the following request will start listening for file changes on the data/trades1.csv and data/trades2.csv files and load any changes into the trades store.
POST https://<hostname>:<port>/<app-context>/connectors/rest/dlc/v2
Content-Type: application/json

{
  "operation": "START_LISTEN",
  "topics": [ "Trades" ]
}

Example: Stop listening

The above example starts listening on a topic. This operation returns a map (String to String) of topic -> listenId. A listener can be cancelled by its listenId. The listenId is a unique hex string. For the following examples, assume the “Trades” topic has a listenId of 5F38A0.
POST https://<hostname>:<port>/<app-context>/connectors/rest/dlc/v2
Content-Type: application/json

{
  "operation": "STOP_LISTEN",
  "topics": [ "5F38A0" ]
}

Example: Unload a store

Data can be unloaded from the application on a store-by-store basis. The default implicit unload topics created will map the provided scope to store fields and match for the provided values. The following request will unload all facts from the trades store where the AsOfDate field is equal to 2024-12-12.
POST https://<hostname>:<port>/<app-context>/connectors/rest/dlc/v2
Content-Type: application/json

{
  "operation": "UNLOAD",
  "topics": [ "Trades" ]
  "scope": {
    "AsOfDate": "2024-12-12"
  }
}
For more information, see Unload Topics.

Example: Initial load

This is an example configuration class which configures data loading on application startup.
@Configuration
public class InitialDataLoadConfig {

    @Bean
    public ApplicationRunner initialConfigDataLoad(IDataLoadControllerService dlc) {
    	return args -> {
    		dlc.execute(
					DlcLoadRequest.builder()
    						.topics("Trades")
    						.build()
    		);
    	};
    }
}

Load into a Branch

The DLC provides the ability to load directly into a specific branch. This can be done by specifying a branch in the DlcLoadRequest. The DLC opens transaction on a specific branch through the transaction manager. Atoti will automatically create the CustomBranchToLoadInto if it does not exist:
The DLC does not manage deletion of branches.
var properties = new Properties();
properties.setProperty(ITransactionManager.BRANCH, "CustomBranchToLoadInto");
datastore.getTransactionManager().startTransaction(properties);
POST https://<hostname>:<port>/<app-context>/connectors/rest/dlc/v2
Content-Type: application/json

{
  "operation": "LOAD",
  "topics": [ "Trades" ],
  "branch": "CustomBranchToLoadInto"
}

Request time overrides

We can override parts of a Topic’s configuration at request time by defining the csvTopicOverrides and/or jdbcTopicOverrides in the request. The topic properties will override the existing topic. It is also possible to define an entirely new topic at request time by providing a topicName that does not already exist nor match any datastore name. All Topic Overrides will only exist for the duration of the request and will not be persisted. A source can be configured to allow or disallow the use of Topic Overrides. Given the above trades topic, it can be overridden at request time to specify a new pathMatcher to use. The following request will load the data/alternative_trades1.csv and data/alternative_trades2.csvfiles into the trades store.
POST https://<hostname>:<port>/<app-context>/connectors/rest/dlc/v2
Content-Type: application/json

{
    "operation": "LOAD",
    "csvTopicOverrides": {
        "newTopic": {
            "filePattern": "glob:alternative_trades*.csv"
        }
    }
}
Example: New load topic
Here we will define a new load topic. This defines a new topic to load a file into the trades store. Since it does not override an existing topic, all aspects of the topic must be defined. Targets and other pre-defined components can be re-used in a new topic. The name we provide for the topic does not matter and will not persist.
POST https://<hostname>:<port>/<app-context>/connectors/rest/dlc/v2
Content-Type: application/json

{
    "operation": "LOAD",
    "csvTopicOverrides": {
        "newTopic": {
            "filePattern": "glob:alternative_trades*.csv",
            "channels": [
                {
                    "targetName": "Trades"
                }
            ]
        }
    }
}

Next steps

The DLC offers more configurations than are covered in this guide. To learn more, read the following sections:
  • Channels - for connecting topics to targets and column calculators
  • ParserOverrides - for overriding the default parser behavior
  • Custom Fields - for enriching data during loading
  • Targets - for defining where data is loaded to and using tuple publishers
  • Custom Topic Ordering - for enforcing the order in which certain topics are processed