-
Notifications
You must be signed in to change notification settings - Fork 357
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
(Dev) Exception logging for EventProcessorHost background exceptions … #1714
Conversation
/// <summary> | ||
/// Constructs a new instance. | ||
/// </summary> | ||
/// <param name="options">The optional <see cref="EventProcessorOptions"/> to use when receiving events.</param> | ||
public EventHubConfiguration(EventProcessorOptions options) |
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.
Making the options a get/set property, symmetric with ServiceBusConfiguration.MessageOptions. All our other config classes have default constructors with settable properties.
@@ -437,6 +439,13 @@ private static Task<object> ConvertPocoToEventData(object arg, Attribute attrRes | |||
return Task.FromResult<object>(ConvertString2EventData(JsonConvert.SerializeObject(arg))); | |||
} | |||
|
|||
internal Action<ExceptionReceivedEventArgs> ExceptionHandler { get; set; } | |||
|
|||
private void ExceptionReceivedHandler(ExceptionReceivedEventArgs args) |
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.
This somewhat strange level of indirection is necessary because the options class is constructed (and handler wired up) before initialize runs and can configure the actual handler. This handler is a ctor param of EventProcessorOptions so must be set up early.
Note that in the v1 version of the EH library the handler is an event so we don't have to do this - we just add an event handler during initialization.
// ensure the EventProcessorOptions ExceptionReceived event is wired up | ||
var eventProcessorOptions = eventHubConfiguration.EventProcessorOptions; | ||
var ex = new EventHubsException(false, "Kaboom!"); | ||
var ctor = typeof(ExceptionReceivedEventArgs).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance).Single(); |
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.
They've decided to make their event args ctor internal so you can't mock it at all :(
…(#1705)
This PR is the dev branch counterpart to #1712