Record Class PulsarFunction

java.lang.Object
java.lang.Record
org.springframework.pulsar.function.PulsarFunction
Record Components:
config - the function details
stopPolicy - the action to take on the function when the server is stopped
updateOptions - the options to use during an update operation (optional)
All Implemented Interfaces:
PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>

public record PulsarFunction(org.apache.pulsar.common.functions.FunctionConfig config, PulsarFunctionOperations.FunctionStopPolicy stopPolicy, @Nullable org.apache.pulsar.common.functions.UpdateOptions updateOptions) extends Record implements PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
Represents a user-defined Pulsar Function backed by a FunctionConfig.
Author:
Chris Bono
  • Constructor Details

    • PulsarFunction

      public PulsarFunction(org.apache.pulsar.common.functions.FunctionConfig config, @Nullable org.apache.pulsar.common.functions.UpdateOptions updateOptions)
    • PulsarFunction

      public PulsarFunction(org.apache.pulsar.common.functions.FunctionConfig config, PulsarFunctionOperations.FunctionStopPolicy stopPolicy, @Nullable org.apache.pulsar.common.functions.UpdateOptions updateOptions)
      Creates an instance of a PulsarFunction record class.
      Parameters:
      config - the value for the config record component
      stopPolicy - the value for the stopPolicy record component
      updateOptions - the value for the updateOptions record component
  • Method Details

    • name

      public String name()
      Description copied from interface: PulsarFunctionOperations
      Gets the name of the function.
      Specified by:
      name in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Returns:
      the name of the function
    • type

      Description copied from interface: PulsarFunctionOperations
      Gets the type of function the operations handles.
      Specified by:
      type in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Returns:
      the type of the function
    • archive

      public String archive()
      Description copied from interface: PulsarFunctionOperations
      Gets the url or path to the archive that represents the function.
      Specified by:
      archive in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Returns:
      the url or path to the archive that represents function
    • get

      public org.apache.pulsar.common.functions.FunctionConfig get(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Description copied from interface: PulsarFunctionOperations
      Gets the configuration details for an existing function.
      Specified by:
      get in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      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
    • updateWithUrl

      public void updateWithUrl(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Description copied from interface: PulsarFunctionOperations
      Updates the function using the url-based update api.
      Specified by:
      updateWithUrl in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • update

      public void update(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Description copied from interface: PulsarFunctionOperations
      Updates the function using the file-based update api.
      Specified by:
      update in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • createWithUrl

      public void createWithUrl(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Description copied from interface: PulsarFunctionOperations
      Creates the function using the url-based create api.
      Specified by:
      createWithUrl in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • create

      public void create(org.apache.pulsar.client.admin.PulsarAdmin admin) throws org.apache.pulsar.client.admin.PulsarAdminException
      Description copied from interface: PulsarFunctionOperations
      Creates the function using the file-based create api.
      Specified by:
      create in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Parameters:
      admin - the admin client
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException - if anything goes wrong
    • stop

      public void stop(org.apache.pulsar.client.admin.PulsarAdmin admin)
      Description copied from interface: PulsarFunctionOperations
      Stops the function.
      Specified by:
      stop in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Parameters:
      admin - the admin client
    • delete

      public void delete(org.apache.pulsar.client.admin.PulsarAdmin admin)
      Description copied from interface: PulsarFunctionOperations
      Deletes the function.
      Specified by:
      delete in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Parameters:
      admin - the admin client
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • config

      public org.apache.pulsar.common.functions.FunctionConfig config()
      Returns the value of the config record component.
      Returns:
      the value of the config record component
    • stopPolicy

      Returns the value of the stopPolicy record component.
      Specified by:
      stopPolicy in interface PulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
      Returns:
      the value of the stopPolicy record component
    • updateOptions

      @Nullable public org.apache.pulsar.common.functions.UpdateOptions updateOptions()
      Returns the value of the updateOptions record component.
      Returns:
      the value of the updateOptions record component