English 中文(简体)
在一届会议上收到一个信息: Bus but after the FullMessageAsync
原标题:Receive one message in one session using Azure ServiceBus but after the CompleteMessageAsync

1 D-1, 1 D-1 页: 1 AutoCompleteMessages = 虚假。

不可能收到同一届会议的下一个信息,直至<代码>。 本届会议的致辞请填满MessageAsync?

早就在电动手填满之后,如果我称之为<密码>,就会收到下一个信息。 页: 1

These are the options for the ServiceBusSessionProcessor:

var processorSessionOptions = new ServiceBusSessionProcessorOptions()
{
    AutoCompleteMessages = false,
    MaxAutoLockRenewalDuration = TimeSpan.FromMinutes(10),
    MaxConcurrentSessions = 5,
    MaxConcurrentCallsPerSession = 1
};

我只想收到会议的一份信息,而不是在<代码>之前收到下一个信息。 页: 1

The result I m getting is that when the message handler finished, the next session message is being received.

问题回答

感谢你的评论 @Sean Feldman 如果本届会议没有需要处理的任何信息,会议处理员将总是召集下一届会议。

是的,在把MessageAsync称作会议致词之前,不可能收到同一届会议的下一个信息:Bus

AFAIK, The serviceBusSessionProcessor 在第一个信息是之前,不提供阻止收到下一个信息的途径。 然而,马克斯·科雷什 每一选择可用来将每届会议同时呼吁的次数限制在一次。 这确保每届会议只处理一个信息。 因此,它将确保每次会议只处理一个电文。

不动产得到最多6.net而不是7.net的支持,详情见SO

 string connectionString = "";
    string queueName = " ";

    var client = new ServiceBusClient(connectionString);
    ServiceBusProcessor processor = client.CreateProcessor(queueName, new ServiceBusProcessorOptions
    {
        MaxConcurrentCalls = 5,
        AutoCompleteMessages = false
    });

    processor.ProcessMessageAsync += ProcessMessageAsync;
    processor.ProcessErrorAsync += ProcessErrorAsync;

    await processor.StartProcessingAsync();

    Console.WriteLine("Press any key to stop receiving...");
    Console.ReadKey();

    await processor.StopProcessingAsync();
    await processor.CloseAsync();
}

private static async Task ProcessMessageAsync(ProcessMessageEventArgs args)
{
    var message = args.Message;

    // Your processing logic here

    // Simulate processing
    await Task.Delay(TimeSpan.FromSeconds(5));

    // Complete the message
    await args.CompleteMessageAsync(message);

    Console.WriteLine($"Message processed and completed.");
}

private static Task ProcessErrorAsync(ProcessErrorEventArgs args)
{
    Console.WriteLine($"Error processing message: {args.Exception.Message}");
    return Task.CompletedTask;
}

<<>Output>:

“enterography





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签