Controller Configuration

Any of the source dependencies must be included in your project’s POM. You can check Atoti Data Connectors Requirements to ensure your project meets the minimum Atoti Server version requirements. You must also include one dependency for each source you wish to add. All supported sources can be found at Atoti Data Connectors Module Structure.

Here is an example of importing Atoti Data Connectors for the CSV and JDBC sources:

    <!-- Atoti Data Connectors CSV Source -->
    <dependency>
        <groupId>com.activeviam.io</groupId>
        <artifactId>data-connectors-csv</artifactId>
        <version>${dataconnectors.version}</version>
    </dependency>
    <!-- Atoti Data Connectors JDBC Source -->
    <dependency>
        <groupId>com.activeviam.io</groupId>
        <artifactId>data-connectors-jdbc</artifactId>
        <version>${dataconnectors.version}</version>
    </dependency>

note

Please contact your project team if you do not have the Atoti Data Connectors JAR file. It needs to be imported in your maven repository.

Next, once the required spring configurations for data source type (CSV, JDBC or Kafka/RabbitMQ) have been configured (examples further below), they need to be registered with the DataLoadController. The following snippets show you how to do that:

Create DataLoadController Bean

@Bean(destroyMethod = "close")
public IDataLoadController dataLoadController() {

    final IDataLoadController controller = new DataLoadController(datastoreConfig.datastore(), null);                
    registerSourceAndChannels(controller);    		            

    return controller;
}            	

Register data Source and Channels

Please read the DLC Data Source Configuration section to learn more about how to configure your Source.

/**
 * Register Channels and Source into the DataLoadController.
 *
 * @param controller The DataLoadController to add our Source and Channels into.
 */
private void registerSourceAndChannels(final IDataLoadController controller) {
	
	/*
	Get or create a Source
	 */
	ISource<?, ?> source = createNewCsvSource(...);

	/*
 	Register Source into the DataLoadController
 	*/
	controller.registerSource(source);


	/*
	Register a channel
 	*/

	IMessageChannel<?, ?> channel = createChannel(...);
	List<String> targetStores = List.of(...);
	IDataLoadController.IScopeToRemoveWhereConditionConverter removeWhereConditionConverter = creatRemoveWhereCondition(...);
	
	controller.registerChannel(channel, targetStores, removeWhereConditionConverter);
}

Remove-where condition for UNLOAD Operations

Here’s an example of a remove-where condition that will remove all facts of a particular AsOfDate provided in the DLC’s UNLOAD Operation’s Scope.

public class AsOfDateScopeToRemoveWhereConditionConverter
        implements IDataLoadController.IScopeToRemoveWhereConditionConverter {

    @Override
    public ICondition apply(
            final String store,
            final Map<String, Object> scope){

        final LocalDate cobDate = LocalDate.parse((String) scope.get("CobDate"));
        return BaseConditions.Equal(FieldPath.of("CobDate"), cobDate);
    }
}

Register topic alias

You may group several topics together under an alias, so that the client / data orchestrator can request to load a single topic alias instead of providing each and every topic name to load in the request. This is useful when submitting a single request to load all the topics.

For example, you may configure an alias “ALL” that groups all the topics together.

protected void registerTopicAliases(IDataLoadController dataLoadController) {
    dataLoadController.registerTopicAlias(
            "All Topics", // Alias Name
            Arrays.asList("Topic 1", "Topic 2", "Alias To Other Topics"));
    }