- we are using azure service bus with azure functions.
- we created an endpoint to subscribe to the MessageFailed event, the handler never gets triggered, the following is my configuration.
public static ServiceBusTriggeredEndpointConfiguration GetAzBusConfiguration(Configuration configuration, string serviceBusEndpointName )
{
var azureServiceBusConfiguration = new ServiceBusTriggeredEndpointConfiguration(serviceBusEndpointName);
azureServiceBusConfiguration.UseSerialization<NewtonsoftSerializer>();
azureServiceBusConfiguration.AdvancedConfiguration.Conventions().DefiningEventsAs(
type =>
{
return typeof(IEvent).IsAssignableFrom(type) ||
// include ServiceControl events
type.Namespace != null &&
type.Namespace.StartsWith("ServiceControl.Contracts");
});
azureServiceBusConfiguration.Transport.CustomTokenCredential(new DefaultAzureCredential());
azureServiceBusConfiguration.Transport.ConnectionString(configuration.AzurSBdNamespace);
return azureServiceBusConfiguration;
}
and my handler is below
public class EndpointsMonitor :
IHandleMessages<MessageFailed>
{
private static readonly ILog Log = LogManager.GetLogger(typeof(EndpointsMonitor));
public async Task Handle(MessageFailed message, IMessageHandlerContext context)
{
Log.Error(
$"Received ServiceControl 'MessageFailed' event for a {message.MessageType} with ID {message.FailedMessageId} in {GetType()}.");
}
}
THanks -Nen