-
Notifications
You must be signed in to change notification settings - Fork 172
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
[v6r21] MQ disconnect only producers #4006
[v6r21] MQ disconnect only producers #4006
Conversation
Also, refactor a bit of code and fix StompMQConnector test.
Also, simplify some code.
Inside subscribe method stomp.py can raise stomp.exception.NotConnectedException. Handle this exception and pass info as S_ERROR.
self.log.error('Failed to subscribe: %s' % e) | ||
fail = True | ||
if fail: | ||
return S_ERROR(EMQUKN, 'Failed to subscribe to at least one broker') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not returning in the exception directly ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure. I think the argument is the following: this for loop is over all connected brokers (we can have more than one for the same connection), we are tryign to close connection to all brokers. If the error occurs for a given broker should we stop immediatly or try to continue anyway with another brokers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not add this logic, it was like that I just cleaned the code a bit.
It should handle the disconnection case for producers.
In connect() method ReconnectListener was added after start() and connect() method are called. According to internal comments in the stomp.py and also looking at the examples it seems that listener should be added before start() method is called.
I don't have specific comments to this PR, so IMHO review OK, but maybe @chaen wants to comment further? |
For me it's fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems ok to me
Solving part of the issue presented in #3986
When MQ server is restarted, the clients are blocked. This fix add a dedicated listener ReconnectListener which in case of the disconnection tries to reconnect to the server.
The set of options such as number of trials, interval time etc are provided. To reconnect the internal
stomp.py connect mechanism is used.
The current solution solves the producer case. Separate patch will be prepared for the consumer case. This needs more refactorization due to the handling of subscription after the disconnection occurs.
As byproduct, the handling of stomp.exception.NotConnectedException which could be raised inside StompMQConnector subscribe() method, has been added. The exception is handled and it is transformed into a standard S_ERROR.
Integration tests done:
Scenario I:
1.Server is unavailable
2.Producer wants to connect and send a message. Producer will try to reconnect.
3.Server goes up
4.Producer connects and sends the message
Scenario II:
1.Producer is connected.
2.Server goes down. Producer is trying to reconnect
3.Server goes up. Producer connects and can send message.
BEGINRELEASENOTES
*Resources
FIX: Resources/MessageQueue: add a dedicated listener ReconnectListener
ENDRELEASENOTES