Interface PulsarFunctionOperations<T>

Type Parameters:
T - the function config (one of SourceConfig, SinkConfig, FunctionConfig)
All Known Implementing Classes:
PulsarFunction, PulsarSink, PulsarSource

public interface PulsarFunctionOperations<T>
Provides operations for a particular function type.

Function Types

The term 'function' is meant to cover Pulsar IO connectors (sources and sinks) as well as Pulsar Functions (user defined functions).

Motivation

The underlying Pulsar function model treats source, sink, and function completely separately, including its config objects and API calls. This operations abstraction allows them to be treated as related during processing.

Author:
Chris Bono
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The action to take on the function when the server stops.
    static enum 
    The type of function the operations handle.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final LogAccessor
    Logger used in default methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the url or path to the archive that represents the function.
    void
    create(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Creates the function using the file-based create api.
    void
    createWithUrl(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Creates the function using the url-based create api.
    void
    delete(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Deletes the function.
    default boolean
    functionExists(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Determines if a function already exists.
    get(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Gets the configuration details for an existing function.
    default Optional<T>
    getIfExists(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Gets the configuration details for a function if it exists.
    Gets the name of the function.
    void
    stop(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Stops the function.
    Gets the action to take on the function when the server is stopped.
    Gets the type of function the operations handles.
    void
    update(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Updates the function using the file-based update api.
    void
    updateWithUrl(org.apache.pulsar.client.admin.PulsarAdmin admin)
    Updates the function using the url-based update api.
  • Field Details

    • logger

      static final LogAccessor logger
      Logger used in default methods.
  • Method Details

    • name

      String name()
      Gets the name of the function.
      Returns:
      the name of the function
    • type

      Gets the type of function the operations handles.
      Returns:
      the type of the function
    • archive

      String archive()
      Gets the url or path to the archive that represents the function.
      Returns:
      the url or path to the archive that represents function
    • stopPolicy

      Gets the action to take on the function when the server is stopped.
      Returns:
      the function stop policy
    • functionExists

      default boolean functionExists(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Determines if a function already exists.
      Parameters:
      admin - the admin client
      Returns:
      true if function already exists
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • getIfExists

      default Optional<T> getIfExists(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Gets the configuration details for a function if it exists.
      Parameters:
      admin - the admin client
      Returns:
      the optional current config of the function or empty if the function does not exist
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything else goes wrong
    • get

      T get(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Gets the configuration details for an existing function.
      Parameters:
      admin - the admin client
      Returns:
      the current config of the existing function
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException.NotFoundException - if function does not exist
      org.apache.pulsar.client.admin.PulsarAdminException - if anything else goes wrong
    • create

      void create(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Creates the function using the file-based create api.
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • createWithUrl

      void createWithUrl(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Creates the function using the url-based create api.
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • update

      void update(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Updates the function using the file-based update api.
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • updateWithUrl

      void updateWithUrl(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Updates the function using the url-based update api.
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • stop

      void stop(org.apache.pulsar.client.admin.PulsarAdmin admin)
      Stops the function.
      Parameters:
      admin - the admin client
      Throws:
      PulsarException - if anything goes wrong
    • delete

      void delete(org.apache.pulsar.client.admin.PulsarAdmin admin)
      Deletes the function.
      Parameters:
      admin - the admin client
      Throws:
      PulsarException - if anything goes wrong