Try to reconnect if connection is lost (replace pika with kombu)#55
Open
matt-snider wants to merge 5 commits intovklochan:masterfrom
Open
Try to reconnect if connection is lost (replace pika with kombu)#55matt-snider wants to merge 5 commits intovklochan:masterfrom
matt-snider wants to merge 5 commits intovklochan:masterfrom
Conversation
Using kombu avoids having to implement redirect logic.
Allowing connection errors to occur makeSocket() causes the failure logic (e.g. exponential backoff, reconnect, etc) from SocketHandler to be triggered. Reraising exceptions in send() allows them to bubble up to emit() and be reported so that they don't just get silently swallowed.
Contributor
Author
|
@vklochan Hey! I saw you commented on the other PR and thought perhaps you had overlooked this one. Let me know if it addresses some of the issues with the previous PRs appropriately |
|
I think this is a great addition to the library. Right now, messages a silently dropped after a connection failure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I need the
AMQPLogstashHandlerto gracefully handle connection failure. Rather than implement this logic in the library as in #34, I recommend switching from pika to kombu.In this PR I essentially just swapped the two libraries and made updates necessary to accommodate that change. This implementation uses kombu's producers pool for publishing, which handles connection failure gracefully. It might also be a good idea to add a max pool size option to the
AMQPLogstashHandler(see setting pool limits).I also updated the socket logic to be more compatible with the
SocketHandlerclass. With the current implementation, we are made aware of connection problems because pika raisespika.exceptions.ConnectionClosed, which escapes the except-block in SocketHandler.createSocket(). With kombu,OSErrorsare raised, which get silently swallowed, so I had to add a modifiedsend().