MarvinCai edited a comment on pull request #10982: URL: https://github.com/apache/pulsar/pull/10982#issuecomment-865973755
I think `receive` and `messageListener` are still different pattern, with former one you decide when to proactively pull and act on the message, the later one is like Lambda just got triggered on every message dispatched to consumer. They are both useful in different scenario. Even if we replace `receive` example with a `messageListener` one, someone might still try to copy & paste that code snippet without knowing how it works under the hood and might not suit their use case. Which IMO is no better than a receive blocking their main thread. Just my two cents, I think we can provide basic example (simple main example with receive) as well as advanced example (messageListener) to just showcase user what they can do with Pulsar API(not how you can create enterprise-grade production-ready application with Pulsar). And if we really want to prevent user from using example as _real_ production code we should addd explicit warning. If we really want to show some best practices the community is using when building application with Pulsar we can add a new section with real world code snippet of how Pulsar API is used in production to produce/consume message. -- 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: us...@infra.apache.org