Thank you for your contribution to the Apache Pulsar project. This document will guide you to understand and implement Pulsar's extensible interface.
Apache Pulsar is a distributed messaging and streaming platform. You can view detailed information here. Pulsar allows users to customize plugins and integrate them into Pulsar to meet customized needs by exposing interfaces and configurations. Many of these plugins are similar and can be reused. This project aims to collect and organize the implementation of various plugins, reduce the development cost caused by repeated implementations in the community, and lower the threshold for using Pulsar.
List the core interfaces in Pulsar that can be implemented by contributors.
org.apache.pulsar.client.api.MessageListenerExecutor.java
org.apache.pulsar.broker.authorization.AuthorizationProvider
org.apache.pulsar.client.api.AuthenticationDataProvider
org.apache.pulsar.functions.auth.FunctionAuthProvider
org.apache.pulsar.functions.auth.KubernetesFunctionAuthProvider
org.apache.pulsar.functions.secretsprovider.SecretsProvider
org.apache.pulsar.transaction.coordinator.TransactionMetadataStoreProvider
org.apache.pulsar.broker.transaction.buffer.TransactionBufferProvider
org.apache.pulsar.broker.transaction.pendingack.TransactionPendingAckStoreProvider
org.apache.pulsar.broker.loadbalance.ModularLoadManager
org.apache.pulsar.common.naming.TopicBundleAssignmentStrategy
org.apache.pulsar.broker.loadbalance.LoadSheddingStrategy
org.apache.pulsar.broker.loadbalance.ModularLoadManagerStrategy
org.apache.pulsar.broker.loadbalance.extensions.filter.BrokerFilter
org.apache.pulsar.client.api.ProducerInterceptor
org.apache.pulsar.client.api.ConsumerInterceptor
org.apache.pulsar.client.api.ReaderInterceptor
org.apache.pulsar.broker.intercept.BrokerInterceptor
org.apache.pulsar.broker.service.TopicEventsListener
org.apache.pulsar.client.api.ConsumerEventListener
org.apache.pulsar.client.impl.transaction.TransactionBufferHandler
org.apache.pulsar.io.core.Sink
org.apache.pulsar.io.core.Source
org.apache.pulsar.functions.api.Function
org.apache.pulsar.broker.service.schema.SchemaStorageFactory
org.apache.pulsar.packages.management.core.PackagesStorageProvider
org.apache.bookkeeper.mledger.ManagedLedger
org.apache.pulsar.broker.stats.prometheus.PrometheusRawMetricsProvider
Provide implementation guide for each type of interfaces.
org.apache.pulsar.client.api.MessageListenerExecutor.java
- Purpose: Select different message processing threads according to business scenarios.
- Sample code: org.apache.pulsar.client.api.impl.KeySharedMessageListenerExecutor, org.apache.pulsar.client.api.impl.CommonMessageListenerExecutor, org.apache.pulsar.client.api.impl.PartitionOrderMessageListenerExecutor
- Purpose: Currently Pulsar has only a few default implementations for authentication and authorization interfaces. Users can customize the required authentication and authorization implementation through this interface.
- Sample code: https://github.com/apache/pulsar/tree/master/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization, https://github.com/apache/pulsar/tree/master/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication
- Purpose: Customize transaction components according to different business requirements. For example, the Transaction Buffer implemented based on the Exactly-once requirement may have different considerations and different implementations.
- Sample code: https://github.com/apache/pulsar/tree/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl, https://github.com/apache/pulsar/tree/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack, https://github.com/apache/pulsar/tree/master/pul sar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator
- Purpose: According to the business scenario of the user, when the existing load balance strategy cannot meet the business needs or is not the best strategy, you can inherit the existing strategy and modify it or completely customize the load balancer strategy suitable for your business.
- Sample code: See the official existing implementation.https://github.com/apache/pulsar/tree/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance
- Purpose: Users can implement Pulsar's interceptor interface to perform logging and auditing, message conversion and filtering. These interceptors often have similar implementations and can be abstracted and reused. For example, a series of interceptors for logging can be fully reused.
- Sample code: None
- Purpose: Connect Pulsar with external systems to import and export data.
- Sample code: https://github.com/apache/pulsar/tree/master/pulsar-io
- Purpose: Implement serverless computing logic to respond to data flow changes in Pulsar.
- Sample code: https://github.com/apache/pulsar/tree/master/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples
- Purpose: Processing logic related to persistent data
- Sample code: https://github.com/apache/pulsar/tree/master/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl, https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorageFactory.java,
- Purpose: Used to customize the generation of metric data in the Prometheus monitoring system
- Sample code:
PrometheusRawMetricsProvider rawMetricsProvider = stream -> stream.write("test_metrics{label1=\"xyz\"} 10 \n");