apache / apache/pulsar

[Enhancement][Consumer] Parallel Execution of Interceptors in `beforeConsume` Method

Open
#23,569 3 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Motivation

Currently, the `beforeConsume` method in `ConsumerInterceptors.java` executes each interceptor sequentially. Since the interceptors operate independently without dependencies on one another, introducing parallel execution can potentially improve performance.

![image](https://github.com/user-attachments/assets/225016b7-5d42-4ccc-a404-7eb454549bb4)

### Solution

_No response_

### Alternatives

_No response_

### Anything else?

_No response_

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

The issue names ConsumerInterceptors.java and its beforeConsume method; start there to understand the current sequential interceptor execution. Determine the required concurrency and completion behavior for independent interceptors, then verify that beforeConsume executes them in parallel without changing consumer semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.