在我的消费者中返回的 Azure 服务总线队列序列号与在生产者中返回并在 Azure 门户中显示的序列号不同?

Returned Azure service bus queue sequence number different in my consumer than what was returned in the producer and shown in the Azure portal?

当我在 Azure 门户和我的应用程序中使用服务总线生产者代码(如下)创建计划的服务总线消息时,我收到了一个序列号。我把它保存在我的数据库中。

问题 - 当我的服务总线消费者代码被计划消息的出列触发时,序列号与服务最初给我的序列号不同总线生产者代码并通过 Azure 门户。

此处显示,其中“13”是 Azure 门户屏幕中显示的序列号。

这里是接收预定消息的代码,可以看到序号不一样!

这是我的消费者代码(觉得不重要)

    private async Task MessageHandler(ProcessMessageEventArgs args)
    {
        string body = args.Message.Body.ToString();
        JObject jsonObject = JObject.Parse(body);
        var eventStatus = (string)jsonObject["EventStatus"];

        await args.CompleteMessageAsync(args.Message);

        // fetch row here by sequence number
        // edit some data from entity, then save
        int result = await dbContext.SaveChangesAsync();

    }

这是我的生产者代码

    public async Task<long> SendMessage(string messageBody, DateTimeOffset scheduledEnqueueTimeUtc)
    {
        await using (ServiceBusClient client = new ServiceBusClient(_config["ServiceBus:Connection"]))
        {
            ServiceBusSender sender = client.CreateSender(_config["ServiceBus:Queue"]);

            ServiceBusMessage message = new ServiceBusMessage(messageBody);

            var sequenceNumber = await sender.ScheduleMessageAsync(message, scheduledEnqueueTimeUtc);
            
            return sequenceNumber;
        }
    }

来自documentation

The SequenceNumber for a scheduled message is only valid while the message is in this state. As the message transitions to the active state, the message is appended to the queue as if had been enqueued at the current instant, which includes assigning a new SequenceNumber.

这是我这边的代码:

using System;
using System.Threading;
using System.Threading.Tasks;
using Azure.Messaging.ServiceBus;

namespace ConsoleApp3
{
    class Program
    {
        static string connectionString = "xxxxxx";
        static string queueName = "myqueue";
        static ServiceBusClient client;
        static ServiceBusProcessor processor;
        static async Task Main(string[] args)
        {
            client = new ServiceBusClient(connectionString);

            processor = client.CreateProcessor(queueName, new ServiceBusProcessorOptions());

            try
            {
                processor.ProcessMessageAsync += MessageHandler;

                processor.ProcessErrorAsync += ErrorHandler;

                await processor.StartProcessingAsync();

                Console.WriteLine("Wait for a minute and then press any key to end the processing");
                Console.ReadKey();

                Console.WriteLine("\nStopping the receiver...");
                await processor.StopProcessingAsync();
                Console.WriteLine("Stopped receiving messages");
            }
            finally
            {
                await processor.DisposeAsync();
                await client.DisposeAsync();
            }
        }

        static async Task MessageHandler(ProcessMessageEventArgs args)
        {
            string body = args.Message.Body.ToString();
            Console.WriteLine($"Received: {body}");
            Console.WriteLine($"ID: {args.Message.MessageId}");

            await args.CompleteMessageAsync(args.Message);
        }
        static Task ErrorHandler(ProcessErrorEventArgs args)
        {
            Console.WriteLine(args.Exception.ToString());
            return Task.CompletedTask;
        }
    }
}

我这边好像没问题:

Message Id 改变了应该是消息因为某些原因被退回了。