-
Notifications
You must be signed in to change notification settings - Fork 143
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
PublishConfirmException when doing RPC before publishing a message. #274
Comments
Hi @jayrulez - thanks for reporting this, I'll try to reproduce it in your sample code and see what can be done about it! |
@pardahlman I seem to have figured out the issue. It's not a problem with RawRabbit per se. I was returning the wrong type Task.FromResult(0) instead of Task.CompletedTask from my event handler. I don't know if there was anyway RawRabbit could know what's wrong there. Any way, we can consider this solved unless you have any input. Regards. |
False positive. The error is still there. Not sure why it worked once and just stopped. I have updated the test app. Try /test1 /test2 /test3 and /test4 to see the results. Regards. |
Hi again @jayrulez, I tried reproduce this in the sample app by injecting a publish right after the RPC request var response = await _busClient.RequestAsync<ValueRequest, ValueResponse>(new ValueRequest {Value = id});
await _busClient.PublishAsync(new TestMessage()); ...and this worked as expected. I haven't had time to setup your application, but I wonder if it might have something to do with the application setup 🤔 . It would be helpful if you could create a minimal sample where this occurs. You might even be able to change the sample in the RawRabbit solution to get in the faulty state? |
Please see 8ca32e7 for reproducing the issue. Maybe you are not able to reproduce it because you have consumer and producer in a different process. |
@pardahlman any thoughts? |
Hello @jayrulez - sorry, not yet. I have had a lot on my plate but will hopefully be able to give this some attention soon |
Hello again, I can reproduce this. It took some time, as I had to figure out what happened in the example code. After a while I could isolate it to an integration test, see below [Fact]
public async Task Throws_Publish_Confirm_Exception_If_Rpc_Response_Sent()
{
using (var client = RawRabbitFactory.CreateTestClient())
{
// Setup
await client.RespondAsync<BasicRequest, BasicResponse>(request => Task.FromResult(new BasicResponse()));
await client.RequestAsync<BasicRequest, BasicResponse>(new BasicRequest());
try
{
// Test
await client.PublishAsync(new BasicMessage());
}
catch (PublishConfirmException e)
{
// Assert
Assert.True(false, e.Message);
}
Assert.True(true);
}
} The problem is not that the request is performed just before the publish, but that the same client publishes the response before the request is published. When debugging the code, I noticed a strange behavior in the underlying |
To catch problem with respond and publish
Hello, @jayrulez - this is fixed in rc1 🎉 |
PublishConfirmException: The broker did not send a publish acknowledgement for message 1 within xx
Error occurs when doing a request immediately before publishing a message.
This test app reproduces the error:
https://github.com/SenitCorp/SenitTest
run the api and browse /api/values
If the order of the statements are changed to put the RPC first then everything works fine.
The text was updated successfully, but these errors were encountered: