Class ThreadRuntimeFactory

java.lang.Object
org.apache.pulsar.functions.runtime.thread.ThreadRuntimeFactory
All Implemented Interfaces:
AutoCloseable, RuntimeFactory

public class ThreadRuntimeFactory extends Object implements RuntimeFactory
Thread based function container factory implementation.
  • Constructor Details

    • ThreadRuntimeFactory

      public ThreadRuntimeFactory(String threadGroupName, String pulsarServiceUrl, String stateStorageImplClass, String storageServiceUrl, org.apache.pulsar.functions.instance.AuthenticationConfig authConfig, org.apache.pulsar.functions.secretsprovider.SecretsProvider secretsProvider, org.apache.pulsar.functions.instance.stats.FunctionCollectorRegistry collectorRegistry, String narExtractionDirectory, ClassLoader rootClassLoader, boolean exposePulsarAdminClientEnabled, String pulsarWebServiceUrl) throws Exception
      This constructor is used by other runtimes (e.g. ProcessRuntime and KubernetesRuntime) that rely on ThreadRuntime to actually run an instance of the function. When used by other runtimes, the arguments such as secretsProvider and rootClassLoader will be provided.
      Throws:
      Exception
  • Method Details

    • initialize

      public void initialize(WorkerConfig workerConfig, org.apache.pulsar.functions.instance.AuthenticationConfig authenticationConfig, org.apache.pulsar.functions.secretsproviderconfigurator.SecretsProviderConfigurator secretsProviderConfigurator, ConnectorsManager connectorsManager, Optional<FunctionAuthProvider> functionAuthProvider, Optional<RuntimeCustomizer> runtimeCustomizer) throws Exception
      Specified by:
      initialize in interface RuntimeFactory
      Throws:
      Exception
    • createContainer

      public ThreadRuntime createContainer(org.apache.pulsar.functions.instance.InstanceConfig instanceConfig, String jarFile, String originalCodeFileName, Long expectedHealthCheckInterval)
      Description copied from interface: RuntimeFactory
      Create a function container to execute a java instance.
      Specified by:
      createContainer in interface RuntimeFactory
      Parameters:
      instanceConfig - java instance config
      jarFile - code file
      expectedHealthCheckInterval - expected health check interval in seconds
      Returns:
      function container to start/stop instance
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface RuntimeFactory