apache / apache/pulsar

[Bug] plugins of Pulsar clients for skywalking

Open
#20,692 1 comment 0 reactions 0 assignees View on GitHub
Stale type/bug
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.

### Version

OS: k8s pod
Pulsar version:
broker:2.10.2
pulsar-client:3.0.0

### Minimal reproduce step

I use pulsar,set consumer config。add negativeAckRedeliveryDelay、deadLetterPolicy params,like this:

```java
consumer = pulsarClient.newConsumer(Schema.STRING)
.consumerName("order-payment")
.topic(TOPIC_PAYMENT)
.subscriptionName("order-payment-sub")
.subscriptionType(SubscriptionType.Shared)
.enableRetry(true)
.negativeAckRedeliveryDelay(30, TimeUnit.SECONDS)
.deadLetterPolicy(DeadLetterPolicy.builder()
.maxRedeliverCount(3)
.retryLetterTopic(RETRY_LETTER_TOPIC_PAYMENT)
.deadLetterTopic(DEAD_LETTER_TOPIC_PAYMENT)
.build())
.messageListener(orderConsumer)
.subscribe();
```

when send message,the error occur:

```
java.lang.ClassCastException: class java.lang.String cannot be cast to class org.apache.skywalking.apm.plugin.pulsar.common.MessageEnhanceRequiredInfo (java.lang.String is in module java.base of loader 'bootstrap'; org.apache.skywalking.apm.plugin.pulsar.common.MessageEnhanceRequiredInfo is in unnamed module of loader org.apache.skywalking.apm.agent.core.plugin.loader.AgentClassLoader @2e4262d2)
at org.apache.skywalking.apm.plugin.pulsar.common.PulsarConsumerListenerInterceptor.lambda$afterMethod$cf935be7$1(PulsarConsumerListenerInterceptor.java:60)
at org.apache.pulsar.client.impl.ConsumerBase.callMessageListener(ConsumerBase.java:1147)
```

### What did you expect to see?

there is no errors,consumer can consume message normally。

### What did you see instead?

the error appearance:

```
java.lang.ClassCastException: class java.lang.String cannot be cast to class org.apache.skywalking.apm.plugin.pulsar.common.MessageEnhanceRequiredInfo (java.lang.String is in module java.base of loader 'bootstrap'; org.apache.skywalking.apm.plugin.pulsar.common.MessageEnhanceRequiredInfo is in unnamed module of loader org.apache.skywalking.apm.agent.core.plugin.loader.AgentClassLoader @2e4262d2)
at org.apache.skywalking.apm.plugin.pulsar.common.PulsarConsumerListenerInterceptor.lambda$afterMethod$cf935be7$1(PulsarConsumerListenerInterceptor.java:60)
at org.apache.pulsar.client.impl.ConsumerBase.callMessageListener(ConsumerBase.java:1147)
```

### Anything else?

_No response_

### Are you willing to submit a PR?

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

Contributor guide

Open the contributing guide

Research direction

Start at PulsarConsumerListenerInterceptor.java line 60 and trace the callback from ConsumerBase.callMessageListener in the reported consumer configuration. Reproduce with negativeAckRedeliveryDelay and deadLetterPolicy enabled, then verify that the consumer processes messages without the reported ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.