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
Add AMQP retry mechanism and example projects #312
Add AMQP retry mechanism and example projects #312
Conversation
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.
Need to find a way to Connect
asynchronously without blocking - it's a bigger issue here due to the backoff.
} | ||
|
||
retry--; | ||
if (retry == 0) |
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.
LGTM
@@ -51,10 +69,45 @@ public override void PreStart() | |||
{ | |||
base.PreStart(); | |||
|
|||
var consumerCallback = GetAsyncCallback<Message>(HandleDelivery); | |||
_receiver.Start(_amqpSourceSettings.Credit, (_, m) => consumerCallback.Invoke(m)); | |||
Connect().Wait(); |
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.
Connect call is blocking here but there isn't much you can do about that - have to wait for the execution to finish somewhere in order to start the message pump.
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.
Actually, come to think of it - might want to just have the async state machine invoke a callback on the stage and signal failure / success. Given that this retry + backoff mechanism can run for several minutes, you don't want to tie the process up for that long. How hard would it be to do that?
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'll give it a look see, it shouldn't be that hard
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.
On second thought, can we separate this into a different PR?
It "works" as it is, I'll work on the thread blocking issue on another PR.
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.
That's fine with me
public override void PreStart() | ||
{ | ||
base.PreStart(); | ||
|
||
Connect().Wait(); |
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.
Same comment as below about blocking on a really long-running call
Closes #288
Adds settings variant that's able to manage the
Connection
andSession
states so that it plays nice with disconnection/reconnection; all the user need to do is provide theAddress
object.