Class WorkerUtils
java.lang.Object
org.apache.pulsar.functions.worker.WorkerUtils
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.pulsar.client.api.Producer<byte[]>createExclusiveProducerWithRetry(org.apache.pulsar.client.api.PulsarClient client, String topic, String producerName, Supplier<Boolean> isLeader, int sleepInBetweenMs) static org.apache.pulsar.client.api.Reader<byte[]>createReader(org.apache.pulsar.client.api.ReaderBuilder readerBuilder, String readerName, String topic, org.apache.pulsar.client.api.MessageId startMessageId) static voiddeleteFromBookkeeper(org.apache.distributedlog.api.namespace.Namespace namespace, String packagePath) static voiddownloadFromBookkeeper(org.apache.distributedlog.api.namespace.Namespace namespace, File outputFile, String packagePath) static voiddownloadFromBookkeeper(org.apache.distributedlog.api.namespace.Namespace namespace, OutputStream outputStream, String packagePath) static FiledumpToTmpFile(InputStream uploadedInputStream) static org.apache.distributedlog.DistributedLogConfigurationgetDlogConf(org.apache.pulsar.functions.worker.WorkerConfig workerConfig) static org.apache.pulsar.common.policies.data.FunctionInstanceStatsImplgetFunctionInstanceStats(String fullyQualifiedInstanceName, FunctionRuntimeInfo functionRuntimeInfo, int instanceId) getIsStillLeaderSupplier(MembershipManager membershipManager, String workerId) static org.apache.pulsar.client.admin.PulsarAdmingetPulsarAdminClient(String pulsarWebServiceUrl) static org.apache.pulsar.client.admin.PulsarAdmingetPulsarAdminClient(String pulsarWebServiceUrl, String authPlugin, String authParams, String tlsTrustCertsFilePath, Boolean allowTlsInsecureConnection, Boolean enableTlsHostnameVerificationEnable) static org.apache.pulsar.client.admin.PulsarAdmingetPulsarAdminClient(String pulsarWebServiceUrl, String authPlugin, String authParams, String tlsTrustCertsFilePath, Boolean allowTlsInsecureConnection, Boolean enableTlsHostnameVerificationEnable, org.apache.pulsar.functions.worker.WorkerConfig workerConfig) static org.apache.pulsar.client.api.PulsarClientgetPulsarClient(String pulsarServiceUrl) static org.apache.pulsar.client.api.PulsarClientgetPulsarClient(String pulsarServiceUrl, String authPlugin, String authParams, Boolean useTls, String tlsTrustCertsFilePath, Boolean allowTlsInsecureConnection, Boolean enableTlsHostnameVerificationEnable) static org.apache.pulsar.client.api.PulsarClientgetPulsarClient(String pulsarServiceUrl, String authPlugin, String authParams, Boolean useTls, String tlsTrustCertsFilePath, Boolean allowTlsInsecureConnection, Boolean enableTlsHostnameVerificationEnable, org.apache.pulsar.functions.worker.WorkerConfig workerConfig) static URIinitializeDlogNamespace(org.apache.pulsar.common.conf.InternalConfigurationData internalConf) static URInewDlogNamespaceURI(String zookeeperServers) static voiduploadFileToBookkeeper(String packagePath, File sourceFile, org.apache.distributedlog.api.namespace.Namespace dlogNamespace) static voiduploadToBookKeeper(org.apache.distributedlog.api.namespace.Namespace dlogNamespace, InputStream uploadedInputStream, String destPkgPath)
-
Method Details
-
uploadFileToBookkeeper
public static void uploadFileToBookkeeper(String packagePath, File sourceFile, org.apache.distributedlog.api.namespace.Namespace dlogNamespace) throws IOException - Throws:
IOException
-
uploadToBookKeeper
public static void uploadToBookKeeper(org.apache.distributedlog.api.namespace.Namespace dlogNamespace, InputStream uploadedInputStream, String destPkgPath) throws IOException - Throws:
IOException
-
downloadFromBookkeeper
public static void downloadFromBookkeeper(org.apache.distributedlog.api.namespace.Namespace namespace, File outputFile, String packagePath) throws IOException - Throws:
IOException
-
downloadFromBookkeeper
public static void downloadFromBookkeeper(org.apache.distributedlog.api.namespace.Namespace namespace, OutputStream outputStream, String packagePath) throws IOException - Throws:
IOException
-
deleteFromBookkeeper
public static void deleteFromBookkeeper(org.apache.distributedlog.api.namespace.Namespace namespace, String packagePath) throws IOException - Throws:
IOException
-
getDlogConf
public static org.apache.distributedlog.DistributedLogConfiguration getDlogConf(org.apache.pulsar.functions.worker.WorkerConfig workerConfig) -
newDlogNamespaceURI
-
initializeDlogNamespace
public static URI initializeDlogNamespace(org.apache.pulsar.common.conf.InternalConfigurationData internalConf) throws IOException - Throws:
IOException
-
getPulsarAdminClient
public static org.apache.pulsar.client.admin.PulsarAdmin getPulsarAdminClient(String pulsarWebServiceUrl) -
getPulsarAdminClient
-
getPulsarAdminClient
public static org.apache.pulsar.client.admin.PulsarAdmin getPulsarAdminClient(String pulsarWebServiceUrl, String authPlugin, String authParams, String tlsTrustCertsFilePath, Boolean allowTlsInsecureConnection, Boolean enableTlsHostnameVerificationEnable, org.apache.pulsar.functions.worker.WorkerConfig workerConfig) -
getPulsarClient
-
getPulsarClient
-
getPulsarClient
public static org.apache.pulsar.client.api.PulsarClient getPulsarClient(String pulsarServiceUrl, String authPlugin, String authParams, Boolean useTls, String tlsTrustCertsFilePath, Boolean allowTlsInsecureConnection, Boolean enableTlsHostnameVerificationEnable, org.apache.pulsar.functions.worker.WorkerConfig workerConfig) -
getFunctionInstanceStats
public static org.apache.pulsar.common.policies.data.FunctionInstanceStatsImpl getFunctionInstanceStats(String fullyQualifiedInstanceName, FunctionRuntimeInfo functionRuntimeInfo, int instanceId) -
dumpToTmpFile
-
createReader
public static org.apache.pulsar.client.api.Reader<byte[]> createReader(org.apache.pulsar.client.api.ReaderBuilder readerBuilder, String readerName, String topic, org.apache.pulsar.client.api.MessageId startMessageId) throws org.apache.pulsar.client.api.PulsarClientException - Throws:
org.apache.pulsar.client.api.PulsarClientException
-
createExclusiveProducerWithRetry
public static org.apache.pulsar.client.api.Producer<byte[]> createExclusiveProducerWithRetry(org.apache.pulsar.client.api.PulsarClient client, String topic, String producerName, Supplier<Boolean> isLeader, int sleepInBetweenMs) throws WorkerUtils.NotLeaderAnymore - Throws:
WorkerUtils.NotLeaderAnymore
-
getIsStillLeaderSupplier
public static Supplier<Boolean> getIsStillLeaderSupplier(MembershipManager membershipManager, String workerId)
-