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

How to handle errors in the interfaces #33

Open
kjersti opened this issue Jul 30, 2020 · 2 comments
Open

How to handle errors in the interfaces #33

kjersti opened this issue Jul 30, 2020 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@kjersti
Copy link

kjersti commented Jul 30, 2020

We use this library to do routing from a SQL queue to an MSMQ. We have experienced that the program stopped processing messages from the SQL queue, without any signal that we were able to detect.

After the fact we have been able to find some traces in logs, indicating that there had been connectivity issues with the SQL database.

After digging through the code, it seems like the default behaviour for endpoints, when the peek or receive circuit breaker triggers, is to stop the endpoint. But, it does not stop the application it's running in. In those cases, we have an application that appears to be running, but it has stopped peeking on the SQL queues. In those cases, we prefer to just kill the application, and let other mechanisms try to restart the application if possible.

Fortunately, there seems to be a way to hook into the interfaces critical error handling, by setting a callback function in the settings, like this

var sqlInterface = _routerConfig.AddInterface<SqlServerTransport>("SQL", t =>
{
   t.GetSettings().Set("onCriticalErrorAction", OnCriticalError()); // The signature of the callback is Func<ICriticalErrorContext, Task>
  // other settings 
});

First, is this an appropriate way to hook up the critical error callback, or is this actually in internal interface, where the settings key might change?

Maybe a small note in the documentation about this? Or maybe the option to hook into the critical error could be made available in the configuration?

@SzymonPobiega
Copy link
Owner

Hi

Thanks for pointing this out. The settings key is stable and won't change but there should be a public API to set the critical handler on top of it. I'll add this API in the next service release. In the meantime you can use the settings. It will continue to work after the public API is added.

@SzymonPobiega SzymonPobiega added the enhancement New feature or request label Aug 17, 2020
@SzymonPobiega SzymonPobiega added this to the 4.0.0 milestone Aug 17, 2020
@kjersti
Copy link
Author

kjersti commented Aug 27, 2020

Thanks for getting back to me, this is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants