Skip to content

Conversation

@jonnepmyra
Copy link
Contributor

When calling Close() on a consumer while still handling messages in the consumer messagehandler, the Close() will throw exception, see issue #154 and the Close finally timeouts like:

System.TimeoutException: The operation has timed out.
   at RabbitMQ.Stream.Client.ManualResetValueTaskSource`1.System.Threading.Tasks.Sources.IValueTaskSource<T>.GetResult(Int16 token)
   at RabbitMQ.Stream.Client.Client.Request[TIn,TOut](Func`2 request, Nullable`1 timeout)
   at RabbitMQ.Stream.Client.Client.Request[TIn,TOut](Func`2 request, Nullable`1 timeout)
   at RabbitMQ.Stream.Client.Client.Close(String reason)
   at RabbitMQ.Stream.Client.Client.MaybeClose(String reason)
   at RabbitMQ.Stream.Client.Consumer.Close()

This PR aims to handle the CreditResponse that can be issued by the server when the subscription is unknown to the server.

@Gsantomaggio Gsantomaggio self-assigned this Aug 26, 2022
@codecov
Copy link

codecov bot commented Aug 26, 2022

Codecov Report

Merging #159 (8dd92dd) into main (dc1fe21) will increase coverage by 0.14%.
The diff coverage is 86.95%.

@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
+ Coverage   92.21%   92.36%   +0.14%     
==========================================
  Files          77       78       +1     
  Lines        6039     6062      +23     
  Branches      378      378              
==========================================
+ Hits         5569     5599      +30     
+ Misses        382      377       -5     
+ Partials       88       86       -2     
Impacted Files Coverage Δ
RabbitMQ.Stream.Client/CreditResponse.cs 85.00% <85.00%> (ø)
RabbitMQ.Stream.Client/Client.cs 91.57% <100.00%> (+0.06%) ⬆️
Tests/ClientTests.cs 97.29% <0.00%> (+1.35%) ⬆️
RabbitMQ.Stream.Client/WireFormatting.cs 74.82% <0.00%> (+4.31%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Just log the message

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio
Copy link
Member

@jonnepmyra thank you for your contribution.
I changed the message log. It is enough to log the message without checking if the Consumer exists or not.

@Gsantomaggio
Copy link
Member

cc @ricsiLT

@ricsiLT
Copy link
Contributor

ricsiLT commented Aug 26, 2022

Neat! Want a test drive before merging? I can certainly arrange that 😏

Also, is this version-specific from RMQ side? Or can I test on whatever 3.10.x?

@Gsantomaggio
Copy link
Member

Or can I test on whatever 3.10.x?

yes you can use 3.10.x Thank you

@ricsiLT
Copy link
Contributor

ricsiLT commented Aug 29, 2022

Works like charm!

@Gsantomaggio
Copy link
Member

Thank you all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants