public class PulsarService extends Object implements AutoCloseable, ShutdownService
| Modifier and Type | Class and Description |
|---|---|
static class |
PulsarService.State |
| Modifier and Type | Field and Description |
|---|---|
protected io.netty.channel.EventLoopGroup |
ioEventLoopGroup |
| Constructor and Description |
|---|
PulsarService(ServiceConfiguration config) |
PulsarService(ServiceConfiguration config,
Optional<WorkerService> functionWorkerService,
Consumer<Integer> processTerminator) |
PulsarService(ServiceConfiguration config,
WorkerConfig workerConfig,
Optional<WorkerService> functionWorkerService,
Consumer<Integer> processTerminator) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
acquireSLANamespace() |
void |
addPrometheusRawMetricsProvider(PrometheusRawMetricsProvider metricsProvider) |
static String |
bookieMetadataServiceUri(ServiceConfiguration config)
Get bookkeeper metadata service uri.
|
protected String |
brokerUrl(ServiceConfiguration config)
Gets the broker service URL (non-TLS) associated with the internal listener.
|
static String |
brokerUrl(String host,
int port) |
String |
brokerUrlTls(ServiceConfiguration config)
Gets the broker service URL (TLS) associated with the internal listener.
|
static String |
brokerUrlTls(String host,
int port) |
void |
close() |
CompletableFuture<Void> |
closeAsync()
Close the current pulsar service.
|
void |
closeMetadataServiceSession()
Close the session to the metadata service.
|
org.apache.pulsar.metadata.api.MetadataStore |
createConfigurationMetadataStore() |
org.apache.pulsar.metadata.api.extended.MetadataStoreExtended |
createLocalMetadataStore() |
LedgerOffloader |
createManagedLedgerOffloader(org.apache.pulsar.common.policies.data.OffloadPoliciesImpl offloadPolicies) |
PulsarAdmin |
getAdminClient() |
BookKeeper |
getBookKeeperClient() |
BookKeeperClientFactory |
getBookKeeperClientFactory() |
Optional<Integer> |
getBrokerListenPort() |
Optional<Integer> |
getBrokerListenPortTls() |
BrokerService |
getBrokerService()
Get a reference of the current
BrokerService instance associated with the current
PulsarService instance. |
ScheduledExecutorService |
getCacheExecutor() |
org.apache.pulsar.client.api.PulsarClient |
getClient() |
Compactor |
getCompactor() |
protected ScheduledExecutorService |
getCompactorExecutor() |
ServiceConfiguration |
getConfiguration()
Get the current service configuration.
|
org.apache.pulsar.metadata.api.coordination.CoordinationService |
getCoordinationService() |
ScheduledExecutorService |
getExecutor() |
org.apache.pulsar.common.conf.InternalConfigurationData |
getInternalConfigurationData() |
LeaderElectionService |
getLeaderElectionService()
Get a reference of the current
LeaderElectionService instance associated with the current
PulsarService instance. |
Optional<Integer> |
getListenPortHTTP() |
Optional<Integer> |
getListenPortHTTPS() |
ScheduledExecutorService |
getLoadManagerExecutor() |
org.apache.pulsar.metadata.api.extended.MetadataStoreExtended |
getLocalMetadataStore() |
ManagedLedgerStorage |
getManagedLedgerClientFactory() |
ManagedLedgerFactory |
getManagedLedgerFactory() |
LedgerOffloader |
getManagedLedgerOffloader(org.apache.pulsar.common.naming.NamespaceName namespaceName,
org.apache.pulsar.common.policies.data.OffloadPoliciesImpl offloadPolicies)
First, get
LedgerOffloader from local map cache,
create new LedgerOffloader if not in cache or
the OffloadPolicies changed, return the LedgerOffloader directly if exist in cache
and the OffloadPolicies not changed. |
String |
getMetadataServiceUri()
Get default bookkeeper metadata service uri.
|
MetricsGenerator |
getMetricsGenerator() |
NamespaceService |
getNamespaceService()
Get a reference of the current namespace service instance.
|
Supplier<NamespaceService> |
getNamespaceServiceProvider() |
Compactor |
getNullableCompactor() |
protected org.apache.bookkeeper.common.util.OrderedScheduler |
getOffloaderScheduler(org.apache.pulsar.common.policies.data.OffloadPoliciesImpl offloadPolicies) |
org.apache.bookkeeper.common.util.OrderedExecutor |
getOrderedExecutor() |
Map<String,String> |
getProtocolDataToAdvertise() |
ResourceUsageTransportManager |
getResourceUsageTransportManager() |
String |
getSafeBrokerServiceUrl()
Deprecated.
|
String |
getSafeWebServiceAddress() |
PulsarService.State |
getState()
Get the current pulsar state.
|
String |
getStatusFilePath() |
TopicPoliciesService |
getTopicPoliciesService() |
org.apache.pulsar.client.api.transaction.TransactionBufferClient |
getTransactionBufferClient() |
TransactionBufferProvider |
getTransactionBufferProvider() |
ExecutorProvider |
getTransactionExecutorProvider() |
TransactionMetadataStoreService |
getTransactionMetadataStoreService() |
Optional<WorkerConfig> |
getWorkerConfig()
Get the current function worker service configuration.
|
WorkerService |
getWorkerService() |
Optional<WorkerService> |
getWorkerServiceOpt() |
ZooKeeperClientFactory |
getZooKeeperClientFactory() |
static WorkerConfig |
initializeWorkerConfigFromBrokerConfig(ServiceConfiguration brokerConfig,
String workerConfigFile) |
static boolean |
isTransactionInternalName(org.apache.pulsar.common.naming.TopicName topicName) |
static boolean |
isTransactionSystemTopic(org.apache.pulsar.common.naming.TopicName topicName) |
void |
loadNamespaceTopics(NamespaceBundle bundle)
Load all the topics contained in a namespace.
|
BookKeeperClientFactory |
newBookKeeperClientFactory() |
protected BrokerService |
newBrokerService(PulsarService pulsar) |
Compactor |
newCompactor() |
void |
shutdownNow()
Shutdown the broker immediately, without waiting for all resources to be released.
|
void |
start()
Start the pulsar service instance.
|
protected void |
startLeaderElectionService() |
protected void |
startLoadManagementService() |
protected void |
startNamespaceService() |
void |
waitUntilClosed()
Block until the service is finally closed.
|
String |
webAddress(ServiceConfiguration config) |
static String |
webAddress(String host,
int port) |
String |
webAddressTls(ServiceConfiguration config) |
static String |
webAddressTls(String host,
int port) |
public PulsarService(ServiceConfiguration config)
public PulsarService(ServiceConfiguration config, Optional<WorkerService> functionWorkerService, Consumer<Integer> processTerminator)
public PulsarService(ServiceConfiguration config, WorkerConfig workerConfig, Optional<WorkerService> functionWorkerService, Consumer<Integer> processTerminator)
public org.apache.pulsar.metadata.api.MetadataStore createConfigurationMetadataStore()
throws org.apache.pulsar.metadata.api.MetadataStoreException
org.apache.pulsar.metadata.api.MetadataStoreExceptionpublic void closeMetadataServiceSession()
throws Exception
Exception - if the close operation failspublic void close()
throws PulsarServerException
close in interface AutoCloseablePulsarServerExceptionpublic CompletableFuture<Void> closeAsync()
public ServiceConfiguration getConfiguration()
public Optional<WorkerConfig> getWorkerConfig()
public void start()
throws PulsarServerException
PulsarServerExceptionpublic org.apache.pulsar.metadata.api.extended.MetadataStoreExtended createLocalMetadataStore()
throws org.apache.pulsar.metadata.api.MetadataStoreException
org.apache.pulsar.metadata.api.MetadataStoreExceptionprotected void startLeaderElectionService()
protected void acquireSLANamespace()
public void waitUntilClosed()
throws InterruptedException
InterruptedExceptionprotected void startNamespaceService()
throws PulsarServerException
PulsarServerExceptionpublic Supplier<NamespaceService> getNamespaceServiceProvider() throws PulsarServerException
PulsarServerExceptionprotected void startLoadManagementService()
throws PulsarServerException
PulsarServerExceptionpublic void loadNamespaceTopics(NamespaceBundle bundle)
bundle - NamespaceBundle to identify the service unitExceptionpublic String getStatusFilePath()
public String getMetadataServiceUri()
public org.apache.pulsar.common.conf.InternalConfigurationData getInternalConfigurationData()
public PulsarService.State getState()
public LeaderElectionService getLeaderElectionService()
LeaderElectionService instance associated with the current
PulsarService instance.LeaderElectionService instance.public NamespaceService getNamespaceService()
public Optional<WorkerService> getWorkerServiceOpt()
public WorkerService getWorkerService() throws UnsupportedOperationException
UnsupportedOperationExceptionpublic BrokerService getBrokerService()
BrokerService instance associated with the current
PulsarService instance.BrokerService instance.public BookKeeper getBookKeeperClient()
public ManagedLedgerFactory getManagedLedgerFactory()
public ManagedLedgerStorage getManagedLedgerClientFactory()
public LedgerOffloader getManagedLedgerOffloader(org.apache.pulsar.common.naming.NamespaceName namespaceName, org.apache.pulsar.common.policies.data.OffloadPoliciesImpl offloadPolicies)
LedgerOffloader from local map cache,
create new LedgerOffloader if not in cache or
the OffloadPolicies changed, return the LedgerOffloader directly if exist in cache
and the OffloadPolicies not changed.namespaceName - NamespaceNameoffloadPolicies - the OffloadPoliciespublic LedgerOffloader createManagedLedgerOffloader(org.apache.pulsar.common.policies.data.OffloadPoliciesImpl offloadPolicies) throws PulsarServerException
PulsarServerExceptionpublic ScheduledExecutorService getExecutor()
public ScheduledExecutorService getCacheExecutor()
public ExecutorProvider getTransactionExecutorProvider()
public ScheduledExecutorService getLoadManagerExecutor()
public org.apache.bookkeeper.common.util.OrderedExecutor getOrderedExecutor()
public ZooKeeperClientFactory getZooKeeperClientFactory()
public BookKeeperClientFactory newBookKeeperClientFactory()
public BookKeeperClientFactory getBookKeeperClientFactory()
protected ScheduledExecutorService getCompactorExecutor()
public Compactor newCompactor() throws PulsarServerException
PulsarServerExceptionpublic Compactor getCompactor() throws PulsarServerException
PulsarServerExceptionpublic Compactor getNullableCompactor()
protected org.apache.bookkeeper.common.util.OrderedScheduler getOffloaderScheduler(org.apache.pulsar.common.policies.data.OffloadPoliciesImpl offloadPolicies)
public org.apache.pulsar.client.api.PulsarClient getClient()
throws PulsarServerException
PulsarServerExceptionpublic PulsarAdmin getAdminClient() throws PulsarServerException
PulsarServerExceptionpublic MetricsGenerator getMetricsGenerator()
public TransactionMetadataStoreService getTransactionMetadataStoreService()
public TransactionBufferProvider getTransactionBufferProvider()
public org.apache.pulsar.client.api.transaction.TransactionBufferClient getTransactionBufferClient()
protected String brokerUrl(ServiceConfiguration config)
public String brokerUrlTls(ServiceConfiguration config)
public String webAddress(ServiceConfiguration config)
public String webAddressTls(ServiceConfiguration config)
public String getSafeWebServiceAddress()
@Deprecated public String getSafeBrokerServiceUrl()
public static String bookieMetadataServiceUri(ServiceConfiguration config)
config - broker configurationpublic TopicPoliciesService getTopicPoliciesService()
public ResourceUsageTransportManager getResourceUsageTransportManager()
public void addPrometheusRawMetricsProvider(PrometheusRawMetricsProvider metricsProvider)
public org.apache.pulsar.metadata.api.extended.MetadataStoreExtended getLocalMetadataStore()
public org.apache.pulsar.metadata.api.coordination.CoordinationService getCoordinationService()
public static WorkerConfig initializeWorkerConfigFromBrokerConfig(ServiceConfiguration brokerConfig, String workerConfigFile) throws IOException
IOExceptionpublic void shutdownNow()
shutdownNow in interface ShutdownServicepublic static boolean isTransactionSystemTopic(org.apache.pulsar.common.naming.TopicName topicName)
public static boolean isTransactionInternalName(org.apache.pulsar.common.naming.TopicName topicName)
protected BrokerService newBrokerService(PulsarService pulsar) throws Exception
ExceptionCopyright © 2017–2022 Apache Software Foundation. All rights reserved.