Skip to content

Latest commit

 

History

History
100 lines (79 loc) · 6.61 KB

conrtibutionGuides.md

File metadata and controls

100 lines (79 loc) · 6.61 KB

Apache Pulsar Plugin Contribution Guide

Welcome

Thank you for your contribution to the Apache Pulsar project. This document will guide you to understand and implement Pulsar's extensible interface.

1. Introduction

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.

2. Core interface list

List the core interfaces in Pulsar that can be implemented by contributors.

2.1 Pulsar client common extension interface

  • org.apache.pulsar.client.api.MessageListenerExecutor.java

2.2 Authentication and authorization related interfaces

  • 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

2.3 Transaction-related interfaces

  • org.apache.pulsar.transaction.coordinator.TransactionMetadataStoreProvider
  • org.apache.pulsar.broker.transaction.buffer.TransactionBufferProvider
  • org.apache.pulsar.broker.transaction.pendingack.TransactionPendingAckStoreProvider

2.4 Load Balancer Extension Interface

  • 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

2.5 Interceptor Interface

  • 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

2.6 Pulsar Connector Interface

  • org.apache.pulsar.io.core.Sink
  • org.apache.pulsar.io.core.Source

2.7 Pulsar Function Interface

  • org.apache.pulsar.functions.api.Function

2.8 Bookkeeper related interfaces

  • org.apache.pulsar.broker.service.schema.SchemaStorageFactory
  • org.apache.pulsar.packages.management.core.PackagesStorageProvider
  • org.apache.bookkeeper.mledger.ManagedLedger

2.9 Metrics related interfaces

  • org.apache.pulsar.broker.stats.prometheus.PrometheusRawMetricsProvider

3. Interface Implementation Guide

Provide implementation guide for each type of interfaces.

3.1 Client common extension interface implementation

  • 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

3.2 Authentication and authorization related interfaces

3.3 Implementation of transaction-related interfaces

3.4 Load balancer extension interface implementation

3.5 Interceptor extension interface implementation

  • 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

3.6 Connector interface implementation

3.7 Pulsar function interface implementation

3.8 Bookkeeper related interface implementation

3.9 Metrics related interface

  • 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");