Using a Validate Address Loqate Spark Job

  1. Create an instance of LoqateAddressingFactory, using its static method getInstance().
  2. Provide the input and output details for the Validate Address Loqate job by creating an instance of LoqateAddressingDetail specifying the ProcessType. The instance must use the type SparkProcessType. For this, the steps are:
    1. Configure the JVM initialization settings by creating an instance of LoqateAddressingGeneralConfiguration.
      Use the enum Enum ExhaustedAction.
    2. Configure the necessary database settings by creating an instance of LoqateAddressingEngineConfiguration and set the various fields.
    3. Configure the address validation settings by creating an instance of LoqateAddressingValidateConfiguration.
      To set the values of the various fields of this instance, use the enums Enum AcceptanceLevel, Enum CountryCodes, Enum OutputCasing, Enum CountryFormat, and Enum ScriptAlphabet.
    4. Set the details of the Reference Data path by creating an instance of ReferenceDataPath. See Enum ReferenceDataPathLocation.
    5. Create an instance of LoqateAddressingDetail, by passing an instance of type JobConfig, the LocalReferenceDataPath instance, and the LoqateAddressingValidateConfiguration instance created earlier as the arguments to its constructor.
      The JobConfig parameter must be an instance of type SparkJobConfig.
      1. Set the details of the input file using the inputPath field of the LoqateAddressingDetail instance.
        Note:
        • For a text input file, create an instance of FilePath with the relevant details of the input file by invoking the appropriate constructor.
        • For an ORC input file, create an instance of OrcFilePath with the path of the ORC input file as the argument.
        • For a parquet input file, create an instance of ParquetFilePath with the path of the parquet input file as the argument.
      2. Set the details of the output file using the outputPath field of the LoqateAddressingDetail instance.
        Note:
        • For a text output file, create an instance of FilePath with the relevant details of the output file by invoking the appropriate constructor.
        • For an ORC output file, create an instance of OrcFilePath with the path of the ORC output file as the argument.
        • For a parquet output file, create an instance of ParquetFilePath with the path of the parquet output file as the argument.

      3. Set the name of the job using the jobName field of the LoqateAddressingDetail instance.
  3. To create and run the Spark job, use the previously created instance of LoqateAddressingFactory to invoke its method runSparkJob(). In this, pass the above instance of LoqateAddressingDetail as an argument.
    The runSparkJob() method runs the job and returns a Map of the reporting counters of the job.
  4. Display the counters to view the reporting statistics for the job.