Reputation: 15579
I am attempting to read the BlobCreated
events from a service bus dead letter topic:
await using(ServiceBusClient serviceBusClient = new ServiceBusClient("xxxxx"))
{
await using (ServiceBusReceiver receiver = serviceBusClient.CreateReceiver("TOPICNAME/Subscriptions/blob-events/$deadletterqueue"))
{
var messages = receiver.ReceiveMessagesAsync(cancellationToken);
//Exception occurs in the enumeration
await foreach(var message in messages)
{
//Process the message
}
}
}
The exception details:
System.ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000. (Parameter 'offset')
at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
at System.DateTimeOffset..ctor(DateTime dateTime)
at Azure.Messaging.ServiceBus.Amqp.AmqpMessageConverter.AmqpMessageToSBMessage(AmqpMessage amqpMessage, Boolean isPeeked)
at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ReceiveMessagesAsyncInternal(Int32 maxMessages, Nullable`1 maxWaitTime, TimeSpan timeout, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ReceiveMessagesAsyncInternal(Int32 maxMessages, Nullable`1 maxWaitTime, TimeSpan timeout, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.<>c.<<ReceiveMessagesAsync>b__38_0>d.MoveNext()
--- End of stack trace from previous location ---
at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ReceiveMessagesAsync(Int32 maxMessages, Nullable`1 maxWaitTime, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(Int32 maxMessages, Nullable`1 maxWaitTime, Boolean isProcessor, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(Int32 maxMessages, Nullable`1 maxWaitTime, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessageAsync(Nullable`1 maxWaitTime, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(CancellationToken cancellationToken)+MoveNext()
at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at CarMax.Online.Media.DlqMonitor.MonitorService.RunAsync(CancellationToken cancellationToken) in C:\git\CarMax\online-systems-media-dlq-monitor\src\CarMax.Online.Media.DlqMonitor\MonitorService.cs:line 98
at CarMax.Online.Media.DlqMonitor.MonitorService.RunAsync(CancellationToken cancellationToken) in C:\git\CarMax\online-systems-media-dlq-monitor\src\CarMax.Online.Media.DlqMonitor\MonitorService.cs:line 98
The issue appears to be around the deserialization of the AMQP message from the wire. How can I get around this / prevent this exception from being thrown?
Note that I am able to poll this topic from legacy .NET Framework 4.7.2
code using the old WindowsAzure.ServiceBus
NuGet package.
Upvotes: 3
Views: 1656
Reputation: 1191
I experienced this issue as well. It appears to be fixed in the pre-release Azure.Messaging.ServiceBus 7.3.0-beta
Discussion of the issue here: https://github.com/Azure/azure-sdk-for-net/issues/23499
Upvotes: 3