You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/26 07:28:05 UTC

[GitHub] [pulsar] jvoigt opened a new issue #10377: Schema prevents usage of Dead Letter Queue DLQ

jvoigt opened a new issue #10377:
URL: https://github.com/apache/pulsar/issues/10377


   **Describe the bug**
   When using a Schema pushing a negativeAcknowledged Message to a DeadletterQueue will fail.
   There is no obvious Errors/Exceptions. The Message, just stay in the current Topic and is never published to the DLQ-Topic.
   When using no Schema oder Schema.STRING it will work.
   
   This happende when using pulsar 2.7.1 and the Java-Client.
   
   Pulsar was started as standalone docker container.
   ```
   $ docker run -it \
     -p 6650:6650 \
     -p 8080:8080 \
     --mount source=pulsardata,target=/pulsar/data \
     --mount source=pulsarconf,target=/pulsar/conf \
     apachepulsar/pulsar:2.7.1 \
     bin/pulsar standalone
   ```
   
   
   **To Reproduce**
   I created an repo with some code for this issue: https://github.com/jvoigt/pulsar-schema-dlq-issue
   
   Steps to reproduce the behavior:
   1. Create Producer to topic with Schema `pulsarClient.newProducer(JSONSchema.of(Payload.class)).create()`
   2. Send Message to Producer `producer.send( new Payload("My Json message"))`
   3. Consume Topic with Schema AND DLQ `pulsarClient.newConsumer(schema).topic(topic)                .deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(3).build()).subscribe()`
   4. receive the Message, but use a nack. `consumer.negativeAcknowledge(msg);` 
   5. The Message will be redeliverd  3 Times, then the DLQ-Topic ist automatically create.
   6. But the Message is never sent.
   
   **Logs**
   See the attached Repo for detailed Logs:
   But Mainly you can see that the client is creating a new Producer for the DLQ-Topic and then nothing more happens.
   
   ```
   Apr 26, 2021 8:19:13 AM com.jvoigt.issue.MyListener received
   INFO:  persistent://public/default/jsonTopic => Message received: {"message":"My Json message"}
   Apr 26, 2021 8:19:13 AM com.jvoigt.issue.MyListener received
   SEVERE: persistent://public/default/jsonTopic => I WILL NACK IT with Counter: 3
   Apr 26, 2021 8:19:16 AM org.apache.pulsar.client.impl.UnAckedMessageTracker$2 run
   WARNING: [ConsumerBase{subscription='subscription', consumerName='5416a', topic='jsonTopic'}] 1 messages have timed-out
   Apr 26, 2021 8:19:16 AM org.apache.pulsar.client.impl.ProducerStatsRecorderImpl init
   INFO: Starting Pulsar producer perf with config: {
     "topicName" : "jsonTopic-subscription-DLQ",
   .....
   }
   Apr 26, 2021 8:19:16 AM org.apache.pulsar.client.impl.ProducerStatsRecorderImpl init
   INFO: Pulsar client config: {
     "serviceUrl" : "pulsar://localhost:6650",
   .....
   }
   Apr 26, 2021 8:19:16 AM org.apache.pulsar.client.impl.ProducerImpl connectionOpened
   INFO: [jsonTopic-subscription-DLQ] [null] Creating producer on cnx [id: 0x7861b6d7, L:/127.0.0.1:43226 - R:localhost/127.0.0.1:6650]
   Apr 26, 2021 8:19:16 AM org.apache.pulsar.client.impl.ProducerImpl lambda$connectionOpened$16
   INFO: [jsonTopic-subscription-DLQ] [standalone-6-1] Created producer on cnx [id: 0x7861b6d7, L:/127.0.0.1:43226 - R:localhost/127.0.0.1:6650]
   Apr 26, 2021 8:20:04 AM org.apache.pulsar.client.impl.ConsumerStatsRecorderImpl lambda$init$0
   INFO: [jsonTopic] [subscription] [5416a] Prefetched messages: 0 --- Consume throughput received: 0.07 msgs/s --- 0.00 Mbit/s --- Ack sent rate: 0.00 ack/s --- Failed messages: 0 --- batch messages: 0 ---Failed acks: 0
   Apr 26, 2021 8:20:24 AM org.apache.pulsar.client.impl.ProducerStatsRecorderImpl init
   INFO: Starting Pulsar producer perf with config: {
     "topicName" : "jsonTopic-subscription-DLQ",
   .....
   }
   Apr 26, 2021 8:20:24 AM org.apache.pulsar.client.impl.ProducerStatsRecorderImpl init
   INFO: Pulsar client config: {
     "serviceUrl" : "pulsar://localhost:6650",
   .....
   }
   Apr 26, 2021 8:20:24 AM org.apache.pulsar.client.impl.ProducerImpl connectionOpened
   INFO: [jsonTopic-subscription-DLQ] [null] Creating producer on cnx [id: 0x7861b6d7, L:/127.0.0.1:43226 - R:localhost/127.0.0.1:6650]
   Apr 26, 2021 8:20:24 AM org.apache.pulsar.client.impl.ProducerImpl lambda$connectionOpened$16
   INFO: [jsonTopic-subscription-DLQ] [standalone-6-2] Created producer on cnx [id: 0x7861b6d7, L:/127.0.0.1:43226 - R:localhost/127.0.0.1:6650]`
   ```
   


-- 
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.

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



[GitHub] [pulsar] linlinnn edited a comment on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn edited a comment on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827511397


   @jvoigt
   I work well locally after add default constructor, could you share your code?


-- 
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.

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



[GitHub] [pulsar] linlinnn edited a comment on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn edited a comment on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-826950579


   @Johannes Voigt You can add default constructor to solve this.
   This issue is not about DLQ, but the schema cannot decode without default constructor.
   @eolivelli any suggestion for enhancement 


-- 
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.

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



[GitHub] [pulsar] linlinnn edited a comment on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn edited a comment on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-826950579


   @jvoigt You can add default constructor to solve this.
   This issue is not about DLQ, but the schema cannot decode without default constructor.
   @eolivelli any suggestion for enhancement 


-- 
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.

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



[GitHub] [pulsar] jvoigt commented on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
jvoigt commented on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827496826


   @linlinnn  
   I've added a constructor. Like this:
   ```
   package com.jvoigt.issue;
   import lombok.Data;
   
   @Data
   class Payload {
       String message;
       public Payload() {
       }
   
       public Payload(String message) {
           this.message = message;
       }
   }
   ```
   But the problem is still there: When using the schema the message will not be delivered to the DLQ-Topic, there are no Logs indicating an error... just nothing happens :)
   
   


-- 
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.

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



[GitHub] [pulsar] linlinnn commented on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn commented on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827511397


   I work well locally after add default constructor, could you share your code?


-- 
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.

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



[GitHub] [pulsar] linlinnn edited a comment on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn edited a comment on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-826950579


   @jvoigt You can add default constructor(or remove @AllArgsConstructor) to solve this.
   This issue is not about DLQ, but the schema cannot decode without default constructor.
   @eolivelli any suggestion for enhancement 


-- 
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.

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



[GitHub] [pulsar] linlinnn commented on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn commented on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827659941


   @jvoigt
   There are some issues in your code.
   1. Consumer should subscribe before producer send message.
   2. The right name of dlq topic is `jsonTopic-subscription-DLQ`(persistent://public/default/jsonTopic-subscription-DLQ).
   3. Add something like `CountDownLatch` to avoid `main thread` exit.


-- 
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.

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



[GitHub] [pulsar] linlinnn edited a comment on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn edited a comment on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827659941


   @jvoigt
   There are some issues in your code.
   1. Consumer should subscribe before producer send message.
   2. The right name of dlq topic is `jsonTopic-subscription-DLQ`(persistent://public/default/jsonTopic-subscription-DLQ).
   3. Add something like `CountDownLatch` to avoid `main thread` exit.
   
   Then you can get expect result, good luck.
   ```shell
   22:41:55.931 [pulsar-external-listener-48-1] INFO  org.apache.pulsar.client.api.DeadLetterTopicTest -  persistent://public/default/jsonTopic-subscription-DLQ => Message received: {"message":"My Payload"}
   22:41:55.931 [pulsar-external-listener-48-1] ERROR org.apache.pulsar.client.api.DeadLetterTopicTest - persistent://public/default/jsonTopic-subscription-DLQ => I WILL NACK IT with Counter: 3
   ```


-- 
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.

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



[GitHub] [pulsar] linlinnn edited a comment on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn edited a comment on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-826950579


   @jvoigt You can add default constructor(or remove `@AllArgsConstructor`) to solve this.
   This issue is not about DLQ, but the schema cannot decode without default constructor.
   @eolivelli any suggestion for enhancement 


-- 
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.

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



[GitHub] [pulsar] eolivelli commented on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827058914


   I cannot see the error in the logs.
   BTW when we write to the DLQ we should not deserialize the payload and encode it again, we just have to copy the payload as it is.
   If we are decoding it we should enhance this mechanism


-- 
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.

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



[GitHub] [pulsar] jvoigt commented on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
jvoigt commented on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827523545


   @linlinnn  i ve pushed the update to https://github.com/jvoigt/pulsar-schema-dlq-issue/blob/master/src/main/java/com/jvoigt/issue/BrokenJsonExample.java


-- 
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.

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



[GitHub] [pulsar] linlinnn edited a comment on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn edited a comment on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-827659941


   @jvoigt
   There are some issues in your code.
   1. Consumer should subscribe before producer send message.
   2. The correct name of dlq topic is `jsonTopic-subscription-DLQ`(persistent://public/default/jsonTopic-subscription-DLQ).
   3. Add something like `CountDownLatch` to avoid `main thread` exit.
   
   Then you can get expect result, good luck.
   ```shell
   22:41:55.931 [pulsar-external-listener-48-1] INFO  org.apache.pulsar.client.api.DeadLetterTopicTest -  persistent://public/default/jsonTopic-subscription-DLQ => Message received: {"message":"My Payload"}
   22:41:55.931 [pulsar-external-listener-48-1] ERROR org.apache.pulsar.client.api.DeadLetterTopicTest - persistent://public/default/jsonTopic-subscription-DLQ => I WILL NACK IT with Counter: 3
   ```


-- 
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.

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



[GitHub] [pulsar] linlinnn commented on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
linlinnn commented on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-826950579


   This issue is not about DLQ, but the schema cannot decode without default constructor.
   @eolivelli any suggestion for enhancement 


-- 
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.

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



[GitHub] [pulsar] codelipenghui commented on issue #10377: Schema prevents usage of Dead Letter Queue DLQ

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #10377:
URL: https://github.com/apache/pulsar/issues/10377#issuecomment-1058891117


   The issue had no activity for 30 days, mark with Stale label.


-- 
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