You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/08/16 14:50:37 UTC

[GitHub] [rocketmq] zxcvbnm3057 opened a new issue #3272: 是否可以在其他线程中标记某消息已被消费?

zxcvbnm3057 opened a new issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272


   遇到一个需求,消费者接收消息后使用netty向客户端发送数据,根据回执判断是否消费成功,现想出种解决办法
   
   1. 全局维护一个HashMap,以消息id为键,是否需要消费为值,consumer接收消息先查询HashMap判断是否需要消费,若仍不能返回已消费,调用netty发送给客户端并返回`RECONSUME_LATER `,获取客户端回执后存入HashMap,下次consumer查询再进行判断(多线程HashMap加锁性能下降,多次重发消息影响rocketmq性能)
   2. 直接返回`RECONSUME_LATER`多次推送,不考虑客户端回执(网络压力大,多次重发消息影响rocketmq性能)
   3. 获取客户端回执后以某种方式通知consumer,或者直接向broker发送消息标注消息已被消费(不知道是否可以实现)
   
   请问这种需求使用rocketmq是否可以实现呢,谢谢


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] francisoliverlee commented on issue #3272: 是否可以在其他线程中标记某消息已被消费?

Posted by GitBox <gi...@apache.org>.
francisoliverlee commented on issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272#issuecomment-900426274


   ### request-reply message can be right for you .
   
   - demo sync producer :  https://github.com/apache/rocketmq/blob/master/example/src/main/java/org/apache/rocketmq/example/rpc/RequestProducer.java
   - demo async producer : https://github.com/apache/rocketmq/blob/master/example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java
   - demo consumer : https://github.com/apache/rocketmq/blob/master/example/src/main/java/org/apache/rocketmq/example/rpc/ResponseConsumer.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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] francisoliverlee commented on issue #3272: 是否可以在其他线程中标记某消息已被消费?

Posted by GitBox <gi...@apache.org>.
francisoliverlee commented on issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272#issuecomment-900426274


   ### request-reply message can be right for you .
   
   - demo sync producer :  https://github.com/apache/rocketmq/blob/master/example/src/main/java/org/apache/rocketmq/example/rpc/RequestProducer.java
   - demo async producer : https://github.com/apache/rocketmq/blob/master/example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java
   - demo consumer : https://github.com/apache/rocketmq/blob/master/example/src/main/java/org/apache/rocketmq/example/rpc/ResponseConsumer.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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] zxcvbnm3057 commented on issue #3272: Is it possible to mark that a message has been consumed in other threads?

Posted by GitBox <gi...@apache.org>.
zxcvbnm3057 commented on issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272#issuecomment-900877543


   Another problem is that `MessageUtil.createReplyMessage` needs to be called to reply in another thread, so it must have the reference of the original request message. If the reply conditions are never matched in ttl time, it may cause memory leak. Is there a better solution for this?


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] zhaohai1299002788 commented on issue #3272: 是否可以在其他线程中标记某消息已被消费?

Posted by GitBox <gi...@apache.org>.
zhaohai1299002788 commented on issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272#issuecomment-899921707


   The consumer receives the message to prove that it has consumed, and the subsequent processing is the processing after the successful consumption, and has nothing to do with mq.


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] zxcvbnm3057 commented on issue #3272: 是否可以在其他线程中标记某消息已被消费?

Posted by GitBox <gi...@apache.org>.
zxcvbnm3057 commented on issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272#issuecomment-899991204


   > The consumer receives the message to prove that it has consumed, and the subsequent processing is the processing after the successful consumption, and has nothing to do with mq.
   
   Thank  you for your response.
   
   Yeah, that's right. I know that rocketmq doesn't care how the message affect consumers. But in my issue I can't know if the message was consumed successfully until client return a response or get timeout state in netty, which was not happend in customer thread. In a word, the subsequent processing produce an effect on return value of consumer and there is at least two thread so I can't just wait(by the way,even if they are in ONE thread, I don't think wait and block the thread is a good solution)
   
   Any further opinions?


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] zxcvbnm3057 closed issue #3272: Is it possible to mark that a message has been consumed in other threads?

Posted by GitBox <gi...@apache.org>.
zxcvbnm3057 closed issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272


   


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] zxcvbnm3057 commented on issue #3272: 是否可以在其他线程中标记某消息已被消费?

Posted by GitBox <gi...@apache.org>.
zxcvbnm3057 commented on issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272#issuecomment-900503281


   Thank you so much!! That's exactly what I need. But I get two other questions.
   
   Firstly, I tried to comment out the codes about reply to producer in ResponseConsumer or just kill the consumer progress, the onException callback in AsyncRequestProducer was called twice. I have read the codes about `DefaultMQProducer.request` and searched issues but found nothing.
   Secondly, if the producer called `request ` and progress broken down before receiving reply, where will reply message go? It can't be customed by other producer in the same group, and the Deadline Queen doesn't seem to be the right box for it.


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] zxcvbnm3057 commented on issue #3272: 是否可以在其他线程中标记某消息已被消费?

Posted by GitBox <gi...@apache.org>.
zxcvbnm3057 commented on issue #3272:
URL: https://github.com/apache/rocketmq/issues/3272#issuecomment-900503281






-- 
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: dev-unsubscribe@rocketmq.apache.org

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