Package org.apache.pulsar.client.impl
Class PulsarClientImpl
java.lang.Object
org.apache.pulsar.client.impl.PulsarClientImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,PulsarClient
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClientConfigurationDataprotected final io.netty.channel.EventLoopGroup -
Constructor Summary
ConstructorsConstructorDescriptionPulsarClientImpl(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) PulsarClientImpl(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, ConnectionPool cnxPool) PulsarClientImpl(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, ConnectionPool cnxPool, io.netty.util.Timer timer) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected <T> CompletableFuture<Reader<T>>createMultiTopicReaderAsync(ReaderConfigurationData<T> conf, Schema<T> schema) CompletableFuture<Producer<byte[]>><T> CompletableFuture<Producer<T>>createProducerAsync(ProducerConfigurationData conf, Schema<T> schema) <T> CompletableFuture<Producer<T>>createProducerAsync(ProducerConfigurationData conf, Schema<T> schema, ProducerInterceptors interceptors) CompletableFuture<Reader<byte[]>>createReaderAsync(ReaderConfigurationData<byte[]> conf) <T> CompletableFuture<Reader<T>>createReaderAsync(ReaderConfigurationData<T> conf, Schema<T> schema) protected <T> CompletableFuture<Reader<T>>createSingleTopicReaderAsync(ReaderConfigurationData<T> conf, Schema<T> schema) io.netty.channel.EventLoopGroupgetConnection(String topic) getConnection(InetSocketAddress logicalAddress, InetSocketAddress physicalAddress) getNumberOfPartitions(String topic) CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata>getPartitionsForTopic(String topic) Read the schema information for a given topic.com.google.common.cache.LoadingCache<String,SchemaInfoProvider> getState()booleanisClosed()ConsumerBuilder<byte[]><T> ConsumerBuilder<T>newConsumer(Schema<T> schema) protected <T> PartitionedProducerImpl<T>newPartitionedProducerImpl(String topic, ProducerConfigurationData conf, Schema<T> schema, ProducerInterceptors interceptors, CompletableFuture<Producer<T>> producerCreatedFuture, org.apache.pulsar.common.partition.PartitionedTopicMetadata metadata) Factory method for creating PartitionedProducerImpl instance.ProducerBuilder<byte[]><T> ProducerBuilder<T>newProducer(Schema<T> schema) protected <T> ProducerImpl<T>newProducerImpl(String topic, int partitionIndex, ProducerConfigurationData conf, Schema<T> schema, ProducerInterceptors interceptors, CompletableFuture<Producer<T>> producerCreatedFuture, Optional<String> overrideProducerName) Factory method for creating ProducerImpl instance.ReaderBuilder<byte[]><T> ReaderBuilder<T>longTableViewBuilder<byte[]><T> TableViewBuilder<T>newTableView(Schema<T> schema) <T> TableViewBuilder<T>newTableViewBuilder(Schema<T> schema) Deprecated.CompletableFuture<Consumer<byte[]>>patternTopicSubscribeAsync(ConsumerConfigurationData<byte[]> conf) protected <T> CompletableFuture<Schema<T>>preProcessSchemaBeforeSubscribe(PulsarClientImpl pulsarClientImpl, Schema<T> schema, String topicName) voidvoidsetLookup(LookupService lookup) voidshutdown()CompletableFuture<Consumer<byte[]>>subscribeAsync(ConsumerConfigurationData<byte[]> conf) <T> CompletableFuture<Consumer<T>>subscribeAsync(ConsumerConfigurationData<T> conf, Schema<T> schema, ConsumerInterceptors<T> interceptors) io.netty.util.Timertimer()visible for pulsar-functions.voidupdateAuthentication(Authentication authentication) voidupdateServiceUrl(String serviceUrl) voidupdateTlsTrustCertsFilePath(String tlsTrustCertsFilePath) voidupdateTlsTrustStorePathAndPassword(String tlsTrustStorePath, String tlsTrustStorePassword)
-
Field Details
-
conf
-
eventLoopGroup
protected final io.netty.channel.EventLoopGroup eventLoopGroup
-
-
Constructor Details
-
PulsarClientImpl
- Throws:
PulsarClientException
-
PulsarClientImpl
public PulsarClientImpl(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) throws PulsarClientException - Throws:
PulsarClientException
-
PulsarClientImpl
public PulsarClientImpl(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, ConnectionPool cnxPool) throws PulsarClientException - Throws:
PulsarClientException
-
PulsarClientImpl
public PulsarClientImpl(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, ConnectionPool cnxPool, io.netty.util.Timer timer) throws PulsarClientException - Throws:
PulsarClientException
-
-
Method Details
-
getConfiguration
-
getClientClock
-
getState
-
newProducer
- Specified by:
newProducerin interfacePulsarClient
-
newProducer
- Specified by:
newProducerin interfacePulsarClient
-
newConsumer
- Specified by:
newConsumerin interfacePulsarClient
-
newConsumer
- Specified by:
newConsumerin interfacePulsarClient
-
newReader
- Specified by:
newReaderin interfacePulsarClient
-
newReader
- Specified by:
newReaderin interfacePulsarClient
-
newTableViewBuilder
Deprecated.usenewTableView(Schema)instead.- Specified by:
newTableViewBuilderin interfacePulsarClient
-
newTableView
- Specified by:
newTableViewin interfacePulsarClient
-
newTableView
- Specified by:
newTableViewin interfacePulsarClient
-
createProducerAsync
-
createProducerAsync
public <T> CompletableFuture<Producer<T>> createProducerAsync(ProducerConfigurationData conf, Schema<T> schema) -
createProducerAsync
public <T> CompletableFuture<Producer<T>> createProducerAsync(ProducerConfigurationData conf, Schema<T> schema, ProducerInterceptors interceptors) -
newPartitionedProducerImpl
protected <T> PartitionedProducerImpl<T> newPartitionedProducerImpl(String topic, ProducerConfigurationData conf, Schema<T> schema, ProducerInterceptors interceptors, CompletableFuture<Producer<T>> producerCreatedFuture, org.apache.pulsar.common.partition.PartitionedTopicMetadata metadata) Factory method for creating PartitionedProducerImpl instance. Allows overriding the PartitionedProducerImpl instance in tests.- Type Parameters:
T- message type class- Parameters:
topic- topic nameconf- producer configurationschema- topic schemainterceptors- producer interceptorsproducerCreatedFuture- future for signaling completion of async producer creationmetadata- partitioned topic metadata- Returns:
- new PartitionedProducerImpl instance
-
newProducerImpl
protected <T> ProducerImpl<T> newProducerImpl(String topic, int partitionIndex, ProducerConfigurationData conf, Schema<T> schema, ProducerInterceptors interceptors, CompletableFuture<Producer<T>> producerCreatedFuture, Optional<String> overrideProducerName) Factory method for creating ProducerImpl instance. Allows overriding the ProducerImpl instance in tests.- Type Parameters:
T- message type class- Parameters:
topic- topic namepartitionIndex- partition index of a partitioned topic. the value -1 is used for non-partitioned topics.conf- producer configurationschema- topic schemainterceptors- producer interceptorsproducerCreatedFuture- future for signaling completion of async producer creation- Returns:
- a producer instance
-
subscribeAsync
-
subscribeAsync
public <T> CompletableFuture<Consumer<T>> subscribeAsync(ConsumerConfigurationData<T> conf, Schema<T> schema, ConsumerInterceptors<T> interceptors) -
patternTopicSubscribeAsync
public CompletableFuture<Consumer<byte[]>> patternTopicSubscribeAsync(ConsumerConfigurationData<byte[]> conf) -
createReaderAsync
-
createReaderAsync
public <T> CompletableFuture<Reader<T>> createReaderAsync(ReaderConfigurationData<T> conf, Schema<T> schema) -
createMultiTopicReaderAsync
protected <T> CompletableFuture<Reader<T>> createMultiTopicReaderAsync(ReaderConfigurationData<T> conf, Schema<T> schema) -
createSingleTopicReaderAsync
protected <T> CompletableFuture<Reader<T>> createSingleTopicReaderAsync(ReaderConfigurationData<T> conf, Schema<T> schema) -
getSchema
Read the schema information for a given topic. If the topic does not exist or it has no schema associated, it will return an empty response -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacePulsarClient- Throws:
PulsarClientException
-
closeAsync
- Specified by:
closeAsyncin interfacePulsarClient
-
shutdown
- Specified by:
shutdownin interfacePulsarClient- Throws:
PulsarClientException
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfacePulsarClient
-
updateServiceUrl
- Specified by:
updateServiceUrlin interfacePulsarClient- Throws:
PulsarClientException
-
updateAuthentication
- Throws:
IOException
-
updateTlsTrustCertsFilePath
-
updateTlsTrustStorePathAndPassword
-
getConnection
-
getConnectionToServiceUrl
-
getConnection
public CompletableFuture<ClientCnx> getConnection(InetSocketAddress logicalAddress, InetSocketAddress physicalAddress) -
timer
public io.netty.util.Timer timer()visible for pulsar-functions. -
externalExecutorProvider
-
newRequestId
public long newRequestId() -
getCnxPool
-
eventLoopGroup
public io.netty.channel.EventLoopGroup eventLoopGroup() -
setLookup
-
getLookup
-
reloadLookUp
- Throws:
PulsarClientException
-
getNumberOfPartitions
-
getPartitionedTopicMetadata
public CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadata(String topic) -
getPartitionsForTopic
- Specified by:
getPartitionsForTopicin interfacePulsarClient
-
getSchemaProviderLoadingCache
public com.google.common.cache.LoadingCache<String,SchemaInfoProvider> getSchemaProviderLoadingCache() -
getMemoryLimitController
-
preProcessSchemaBeforeSubscribe
protected <T> CompletableFuture<Schema<T>> preProcessSchemaBeforeSubscribe(PulsarClientImpl pulsarClientImpl, Schema<T> schema, String topicName) -
getInternalExecutorService
-
getScheduledExecutorProvider
-
newTransaction
- Specified by:
newTransactionin interfacePulsarClient
-
newTableView(Schema)instead.