类 FunctionRuntimeManager
java.lang.Object
org.apache.pulsar.functions.worker.FunctionRuntimeManager
- 所有已实现的接口:
AutoCloseable
This class managers all aspects of functions assignments and running of function assignments for this worker
-
构造器概要
构造器构造器说明FunctionRuntimeManager(org.apache.pulsar.functions.worker.WorkerConfig workerConfig, PulsarWorkerService workerService, org.apache.distributedlog.api.namespace.Namespace dlogNamespace, MembershipManager membershipManager, org.apache.pulsar.functions.worker.ConnectorsManager connectorsManager, FunctionsManager functionsManager, FunctionMetaDataManager functionMetaDataManager, WorkerStatsManager workerStatsManager, ErrorNotifier errorNotifier) -
方法概要
修饰符和类型方法说明voidclose()voiddeleteAssignment(String fullyQualifiedInstanceId) org.apache.pulsar.functions.proto.Function.AssignmentfindFunctionAssignment(String tenant, String namespace, String functionName, int instanceId) Find a assignment of a functionCollection<org.apache.pulsar.functions.proto.Function.Assignment>findFunctionAssignments(String tenant, String namespace, String functionName) Find all instance assignments of functionstatic Collection<org.apache.pulsar.functions.proto.Function.Assignment>findFunctionAssignments(String tenant, String namespace, String functionName, Map<String, Map<String, org.apache.pulsar.functions.proto.Function.Assignment>> workerIdToAssignments) Get current assignmentsorg.apache.pulsar.common.policies.data.FunctionInstanceStatsDataImplgetFunctionInstanceStats(String tenant, String namespace, String functionName, int instanceId, URI uri) Get stats of a function instance.getFunctionRuntimeInfo(String fullyQualifiedInstanceId) org.apache.pulsar.common.policies.data.FunctionStatsImplgetFunctionStats(String tenant, String namespace, String functionName, URI uri) Get stats of all function instances.intMethods for metricsorg.apache.pulsar.client.api.MessageIdInitializes the FunctionRuntimeManager.voidprocessAssignment(org.apache.pulsar.functions.proto.Function.Assignment newAssignment) Process an assignment update from the assignment topicvoidprocessAssignmentMessage(org.apache.pulsar.client.api.Message<byte[]> msg) voidremoveAssignments(Collection<org.apache.pulsar.functions.proto.Function.Assignment> assignments) Removes a collection of assignmentsvoidrestartFunctionInstance(String tenant, String namespace, String functionName, int instanceId, URI uri) voidrestartFunctionInstances(String tenant, String namespace, String functionName) voidIt stops all functions instances owned by current worker
-
构造器详细资料
-
FunctionRuntimeManager
public FunctionRuntimeManager(org.apache.pulsar.functions.worker.WorkerConfig workerConfig, PulsarWorkerService workerService, org.apache.distributedlog.api.namespace.Namespace dlogNamespace, MembershipManager membershipManager, org.apache.pulsar.functions.worker.ConnectorsManager connectorsManager, FunctionsManager functionsManager, FunctionMetaDataManager functionMetaDataManager, WorkerStatsManager workerStatsManager, ErrorNotifier errorNotifier) throws Exception - 抛出:
Exception
-
-
方法详细资料
-
initialize
public org.apache.pulsar.client.api.MessageId initialize()Initializes the FunctionRuntimeManager. Does the following: 1. Consume all existing assignments to establish existing/latest set of assignments 2. After current assignments are read, assignments belonging to this worker will be processed- 返回:
- the message id of the message processed during init phase
-
getCurrentAssignments
public Map<String,Map<String, getCurrentAssignments()org.apache.pulsar.functions.proto.Function.Assignment>> Get current assignments- 返回:
- a map of current assignments in the following format {workerId : {FullyQualifiedInstanceId : Assignment}}
-
findFunctionAssignment
public org.apache.pulsar.functions.proto.Function.Assignment findFunctionAssignment(String tenant, String namespace, String functionName, int instanceId) Find a assignment of a function- 参数:
tenant- the tenant the function belongs tonamespace- the namespace the function belongs tofunctionName- the function name- 返回:
- the assignment of the function
-
findFunctionAssignments
public Collection<org.apache.pulsar.functions.proto.Function.Assignment> findFunctionAssignments(String tenant, String namespace, String functionName) Find all instance assignments of function- 参数:
tenant-namespace-functionName-- 返回:
-
findFunctionAssignments
-
removeAssignments
public void removeAssignments(Collection<org.apache.pulsar.functions.proto.Function.Assignment> assignments) Removes a collection of assignments- 参数:
assignments- assignments to remove
-
restartFunctionInstance
public void restartFunctionInstance(String tenant, String namespace, String functionName, int instanceId, URI uri) throws Exception - 抛出:
Exception
-
restartFunctionInstances
public void restartFunctionInstances(String tenant, String namespace, String functionName) throws Exception - 抛出:
Exception
-
stopAllOwnedFunctions
public void stopAllOwnedFunctions()It stops all functions instances owned by current worker- 抛出:
Exception
-
getFunctionInstanceStats
public org.apache.pulsar.common.policies.data.FunctionInstanceStatsDataImpl getFunctionInstanceStats(String tenant, String namespace, String functionName, int instanceId, URI uri) Get stats of a function instance. If this worker is not running the function instance.- 参数:
tenant- the tenant the function belongs tonamespace- the namespace the function belongs tofunctionName- the function nameinstanceId- the function instance id- 返回:
- jsonObject containing stats for instance
-
getFunctionStats
public org.apache.pulsar.common.policies.data.FunctionStatsImpl getFunctionStats(String tenant, String namespace, String functionName, URI uri) throws org.apache.pulsar.client.admin.PulsarAdminException Get stats of all function instances.- 参数:
tenant- the tenant the function belongs tonamespace- the namespace the function belongs tofunctionName- the function name- 返回:
- a list of function statuses
- 抛出:
org.apache.pulsar.client.admin.PulsarAdminException
-
processAssignmentMessage
public void processAssignmentMessage(org.apache.pulsar.client.api.Message<byte[]> msg) -
processAssignment
public void processAssignment(org.apache.pulsar.functions.proto.Function.Assignment newAssignment) Process an assignment update from the assignment topic- 参数:
newAssignment- the assignment
-
deleteAssignment
-
getFunctionRuntimeInfos
-
close
- 指定者:
close在接口中AutoCloseable- 抛出:
Exception
-
getFunctionRuntimeInfo
-
getMyInstances
public int getMyInstances()Methods for metrics
-