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:
[email protected]