Record Class PulsarFunction
java.lang.Object
java.lang.Record
org.springframework.pulsar.function.PulsarFunction
- Record Components:
config
- the function detailsstopPolicy
- the action to take on the function when the server is stoppedupdateOptions
- 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.pulsar.function.PulsarFunctionOperations
PulsarFunctionOperations.FunctionStopPolicy, PulsarFunctionOperations.FunctionType
-
Field Summary
Fields inherited from interface org.springframework.pulsar.function.PulsarFunctionOperations
logger
-
Constructor Summary
ConstructorDescriptionPulsarFunction
(org.apache.pulsar.common.functions.FunctionConfig config, org.apache.pulsar.common.functions.UpdateOptions updateOptions) PulsarFunction
(org.apache.pulsar.common.functions.FunctionConfig config, PulsarFunctionOperations.FunctionStopPolicy stopPolicy, org.apache.pulsar.common.functions.UpdateOptions updateOptions) Creates an instance of aPulsarFunction
record class. -
Method Summary
Modifier and TypeMethodDescriptionarchive()
Gets the url or path to the archive that represents the function.org.apache.pulsar.common.functions.FunctionConfig
config()
Returns the value of theconfig
record component.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.final boolean
Indicates whether some other object is "equal to" this one.org.apache.pulsar.common.functions.FunctionConfig
get
(org.apache.pulsar.client.admin.PulsarAdmin admin) Gets the configuration details for an existing function.final int
hashCode()
Returns a hash code value for this object.name()
Gets the name of the function.void
stop
(org.apache.pulsar.client.admin.PulsarAdmin admin) Stops the function.Returns the value of thestopPolicy
record component.final String
toString()
Returns a string representation of this record class.type()
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.org.apache.pulsar.common.functions.UpdateOptions
Returns the value of theupdateOptions
record component.void
updateWithUrl
(org.apache.pulsar.client.admin.PulsarAdmin admin) Updates the function using the url-based update api.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.pulsar.function.PulsarFunctionOperations
functionExists, getIfExists
-
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 aPulsarFunction
record class.- Parameters:
config
- the value for theconfig
record componentstopPolicy
- the value for thestopPolicy
record componentupdateOptions
- the value for theupdateOptions
record component
-
-
Method Details
-
name
Description copied from interface:PulsarFunctionOperations
Gets the name of the function.- Specified by:
name
in interfacePulsarFunctionOperations<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 interfacePulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
- Returns:
- the type of the function
-
archive
Description copied from interface:PulsarFunctionOperations
Gets the url or path to the archive that represents the function.- Specified by:
archive
in interfacePulsarFunctionOperations<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 interfacePulsarFunctionOperations<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 existorg.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 interfacePulsarFunctionOperations<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 interfacePulsarFunctionOperations<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 interfacePulsarFunctionOperations<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 interfacePulsarFunctionOperations<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 interfacePulsarFunctionOperations<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 interfacePulsarFunctionOperations<org.apache.pulsar.common.functions.FunctionConfig>
- Parameters:
admin
- the admin client
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
config
public org.apache.pulsar.common.functions.FunctionConfig config()Returns the value of theconfig
record component.- Returns:
- the value of the
config
record component
-
stopPolicy
Returns the value of thestopPolicy
record component.- Specified by:
stopPolicy
in interfacePulsarFunctionOperations<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 theupdateOptions
record component.- Returns:
- the value of the
updateOptions
record component
-