Configure Exception Handling
Event Hubs’ exceptions provide very clear information regarding the reason for errors. All Event Hub issues throw an EventHubsException
exception object. The EventHubsException
exception object, IsTransient
, indicates the actual reason for the exception and whether the exceptions can be retried.
Note
This section primarily focuses on the Configure exception handling concept of the DP-203: Data Engineering on Microsoft Azure exam.
Some examples include timeouts, exceeding quota limits, exceeding message sizes, and client connection disconnects. The following is a simple example of how you can catch exceptions in .NET:
try
{
// Process Events
}
catch (EventHubsException ex) where
(ex.Reason == EventHubsException.FailureReason.MessageSizeExceeded)
{
// Take action for the oversize messages
}
The preceding code demonstrates how to catch and handle a specific type of...