You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Shawyeok (via GitHub)" <gi...@apache.org> on 2025/01/02 03:44:39 UTC

[I] [Bug] Cannot access message value via Message#getValue inside ProducerInterceptor#onSendAcknowledgement [pulsar]

Shawyeok opened a new issue, #23800:
URL: https://github.com/apache/pulsar/issues/23800

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
   
   
   ### Read release policy
   
   - [X] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
   
   
   ### Version
   
   2.11+
   
   ### Minimal reproduce step
   
   ```java
       @Test
       public void testProducerInterceptorAccessMessageValue() throws PulsarClientException {
           List<String> messageValueOnSendAcknowledgement = Collections.synchronizedList(new ArrayList<>());
           ProducerInterceptor<String> interceptor = new ProducerInterceptor<>() {
               @Override
               public void close() {
               }
   
               @Override
               public Message<String> beforeSend(Producer<String> producer, Message<String> message) {
                   return message;
               }
   
               @Override
               public void onSendAcknowledgement(Producer<String> producer, Message<String> message, MessageId msgId,
                                                 Throwable exception) {
                   messageValueOnSendAcknowledgement.add(message.getValue());
               }
           };
           @Cleanup
           Producer<String> producer = pulsarClient.newProducer(Schema.STRING)
                   .topic("persistent://my-property/my-ns/my-topic")
                   .intercept(interceptor)
                   .create();
   
           final String messageValue = UUID.randomUUID().toString();
           try {
               producer.newMessage().value(messageValue).send();
           } catch (Exception ignore) {
           }
           Assert.assertEquals(messageValueOnSendAcknowledgement.size(), 1);
           Assert.assertEquals(messageValueOnSendAcknowledgement.get(0), messageValue);
       }
   ```
   
   ### What did you expect to see?
   
   Return message value properly
   
   ### What did you see instead?
   
   Empty message returned
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] Cannot access message value via Message#getValue inside ProducerInterceptor#onSendAcknowledgement [pulsar]

Posted by "Shawyeok (via GitHub)" <gi...@apache.org>.
Shawyeok closed issue #23800: [Bug] Cannot access message value via Message#getValue inside ProducerInterceptor#onSendAcknowledgement
URL: https://github.com/apache/pulsar/issues/23800


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org