Class WorkerClientFactory

java.lang.Object
fr.gouv.vitam.common.client.VitamClientFactory<WorkerClient>
fr.gouv.vitam.worker.client.WorkerClientFactory
All Implemented Interfaces:
VitamClientFactoryInterface<WorkerClient>

public class WorkerClientFactory extends VitamClientFactory<WorkerClient>

WorkerClient factory

Used to get a worker client depending on its type. Example :

 {
     @code
     // Retrieves a  worker client given a configuration
       WorkerClientConfiguration configuration1 = new  WorkerClientConfiguration("localhost",8076);
     WorkerClient client = WorkerClientFactory.getInstance(configuration1).getWorkerClient();

     // Exists
     client.exists(asyncId);
 }
 
You can change the type of the client to get. The types are defined in the enum WorkerClient. Use the changeDefaultClientType method to change the client type.
  • Field Details

  • Method Details

    • getInstance

      public static WorkerClientFactory getInstance(WorkerClientConfiguration configuration)
      get Specifique workerfactory instance
      Parameters:
      configuration - the worker client configuration
      Returns:
      an instance of WorkerClientFactory
    • getClient

      public WorkerClient getClient()
      Get the default worker client
      Returns:
      the default worker client
    • changeConfigurationFile

      public static final WorkerClientConfiguration changeConfigurationFile(String configurationPath)
      Change client configuration from a Yaml files
      Parameters:
      configurationPath - the path to the configuration file
      Returns:
      un instance of WorkerClientConfiguration
    • changeMode

      public static final void changeMode(WorkerClientConfiguration configuration)
      Parameters:
      configuration - null for MOCK