Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

message ack problem in retry or rePush by closeSession #457

Closed
lrhkobe opened this issue Jul 22, 2021 · 0 comments
Closed

message ack problem in retry or rePush by closeSession #457

lrhkobe opened this issue Jul 22, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@lrhkobe
Copy link
Contributor

lrhkobe commented Jul 22, 2021

The scenes of message downstream action:

  1. normal downstream
public void subscribe(SubscriptionItem subscriptionItem) throws Exception {
     ....
      //msg put in eventmesh,waiting client ack
     session.getPusher().unAckMsg(downStreamMsgContext.seq, downStreamMsgContext);

     session.downstreamMsg(downStreamMsgContext);
    ...
}
  1. when downstream fail, push retry queue, execute downstream
private void retryHandle(DownStreamMsgContext downStreamMsgContext) {
    ...
    downStreamMsgContext.session = rechoosen;
    rechoosen.downstreamMsg(downStreamMsgContext);
    ...
}
  1. when closeSession, the session has downstreamed msg which is unAcked, and there is other session which is belonged to same consumer group, the unAcked msg will repush to other client with same group
private void handleUnackMsgsInSession(Session session) {
       ...
      downStreamMsgContext.session = reChooseSession;
      reChooseSession.downstreamMsg(downStreamMsgContext);
      ...
 }

The scene2 and scene3 have ack problem, because the msg does not put in unAckMap of the rechoosed session. When the rechoosed session repley ack, this leads EventMesh can not find the msg to ack .

Message downstream process in EventMesh:

  1. select a session(client)
  2. put the msg in a map of selected session
  3. execute downstream action

Message ack process in EventMesh:

  1. session(client) reply ack msg to EventMesh
  2. EventMesh execute ack action in MessageAckTask.java
        DownStreamMsgContext downStreamMsgContext = session.getPusher().getUnAckMsg().get(seq);
        if (downStreamMsgContext != null) {
            downStreamMsgContext.ackMsg();
            session.getPusher().getUnAckMsg().remove(seq);
        }else {
           logger.warn("MessageAckTask, seq:{}, downStreamMsgContext not in downStreamMap,client:{}", seq, session.getClient());
        }
@lrhkobe lrhkobe added the bug Something isn't working label Jul 22, 2021
xwm1992 pushed a commit to xwm1992/EventMesh that referenced this issue Dec 27, 2021
…sion (apache#459)

* modify:optimize flow control in downstreaming msg

* modify:optimize stategy of selecting session in downstream msg

* modify:optimize msg downstream,msg store in session

* modify:fix bug:not a @sharable handler

* modify:downstream broadcast msg asynchronously

* modify:remove unneccessary interface in eventmesh-connector-api

* modify:fix conflict

* modify:add license in EventMeshAction

* modify:fix ack problem

close apache#457
xwm1992 pushed a commit that referenced this issue Aug 4, 2022
…459)

* modify:optimize flow control in downstreaming msg

* modify:optimize stategy of selecting session in downstream msg

* modify:optimize msg downstream,msg store in session

* modify:fix bug:not a @sharable handler

* modify:downstream broadcast msg asynchronously

* modify:remove unneccessary interface in eventmesh-connector-api

* modify:fix conflict

* modify:add license in EventMeshAction

* modify:fix ack problem

close #457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant