meierhofer08 edited a comment on pull request #3613:
URL: https://github.com/apache/activemq-artemis/pull/3613#issuecomment-856648019


   Hmm good question. I didn't want to change the existing code too much to 
avoid any additional side effects.
   In handleFailover, the "ActiveMQSessionContext.reattachOnNewConnection" 
executes
   - this.remotingConnection = newConnection; and
   - sessionChannel.transferConnection((CoreRemotingConnection) newConnection);
   before sending any packages to the broker. I wanted to ensure both are 
executed for every session to stay as close as possible to the original 
behaviour of the code (session.handleFailover was called for every session in 
the original HornetQ donation).
   
   Detaching the sessions in preHandleFailover is not so easy as 
"transferConnection" cannot be called because there is no new connection yet at 
that point. And I'm not sure if just detaching from the old connection is fine, 
there is no method for this (yet) and the current transferConnection sets 
"transferring = true", I'm not sure if I can set this when just removing the 
old connection.
   
   I think the best compromise that shouldn't create issues would be to call 
session.getSessionContext().getSessionChannel().transferConnection() for the 
remaining sessions after 1 session's handleFailover() fails, or create 
something like a "clientHandleFailover" that wraps this and doesn't do any 
server requests for the remaining sessions.


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


Reply via email to