Skip to content
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

Address RabbitMQ Lifecycline in webapi container #114

Open
angrave opened this issue Oct 5, 2020 · 0 comments
Open

Address RabbitMQ Lifecycline in webapi container #114

angrave opened this issue Oct 5, 2020 · 0 comments
Assignees

Comments

@angrave
Copy link
Collaborator

angrave commented Oct 5, 2020

api | 2020-10-05T04:06:26.418637135Z fail: Microsoft.AspNetCore.Server.Kestrel[13]
api | 2020-10-05T04:06:26.418861157Z Connection id "0HM38OS2JSBOO", Request id "0HM38OS2JSBOO:0000001D": An unhandled exception was thrown by the application.
api | 2020-10-05T04:06:26.419017747Z System.NullReferenceException: Object reference not set to an instance of an object.
api | 2020-10-05T04:06:26.419062795Z at CTCommons.RabbitMQConnection.Dispose(Boolean disposing) in /src/CTCommons/RabbitMQ/RabbitMQConnection.cs:line 268
api | 2020-10-05T04:06:26.419091515Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.DisposeAsync()
api | 2020-10-05T04:06:26.419118001Z --- End of stack trace from previous location where exception was thrown ---
api | 2020-10-05T04:06:26.419145603Z at Microsoft.AspNetCore.Http.Features.RequestServicesFeature.g__Awaited|9_0(RequestServicesFeature servicesFeature, ValueTask vt)
api | 2020-10-05T04:06:26.419251537Z at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.FireOnCompletedAwaited(Task currentTask, Stack`1 onCompleted)

Line 268 is the closing brace of virtual void Dispose(bool disposing)

The current code discards the connection and channel every time we dispose of this object.

We should at least persist the connection over the lifetime of the application, and probably the channel too. Should we make this object a Singleton defined using DependencyInjection?

@angrave angrave self-assigned this Oct 6, 2020
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

No branches or pull requests

1 participant