Customize the Data Load Controller Config

The DataLoadControllerConfig bean controls how data should be loaded into Atoti Limits. To customize the DataLoadControllerConfig bean, just create a new class and implement the IDataLoadControllerConfig interface or extend a class which implements the IDataLoadControllerConfig interface. For more information on the Data Load Controller, see the Data Connectors documentation.

The IDataLoadControllerConfig interface

The interface contains two methods for you to override:

  • dataLoadController(): returns a new IDataLoadController object
  • registerCsvSourceAndChannels(final IDataLoadController controller): register CSV Scoped Source and StoreMessageChannels with the IDataLoadController object.
/**
   * @return - IDataLoadController object to execute DLC requests against and store registered
   *     {@link com.qfs.msg.IMessageChannel}s.
   */
  IDataLoadController dataLoadController();

  /**
   * Register the CSV Source and each of the StoreMessage channels.
   *
   * @param controller - {@link com.activeviam.io.IDataLoadController} object.
   */
  void registerCsvSourceAndChannels(final IDataLoadController controller);

Example CustomDataLoadControllerConfig

1. Create the Spring Bean

Below is a custom DataLoadControllerConfig class, which adds another StoreMessageChannel to the default configuration.

public class CustomDataLoadControllerConfig extends DataLoadControllerConfig { // DataLoadControllerConfig implements the IDataLoadControllerConfig interface

    @Override
    public void registerCsvSourceAndChannels(final IDataLoadController controller) {
        super.registerCsvSourceAndChannels(controller);
        // Define custom channel
        IStoreMessageChannel customChannel = sourceBulkLoadChannelFactory
                .createChannel(CUSTOM_TOPIC_NAME, CUSTOM_STORE_NAME, customTuplePublisher)
                .accumulate();
        
        // Get customTuplePublisher's target stores
        List<String> customTargetStores = customTuplePublisher.getTargetStores();
        IDataLoadController.IScopeToRemoveWhereConditionConverter removeWhereConditionConverter = new FullClearRemoveWhereConditionConverter();
        
        // Register the custom channel to default IDataLoadController controller
        controller.registerChannel(
                customChannel,
                customTargetStores,
                removeWhereConditionConverter);
    }
    
}

2. Import the Spring Bean

Once the bean is created, import it into the project. See Importing Spring Beans into the Project on how to do this. Once done, Spring will use the custom bean when configuring the Data Load Controller.